Skip to content

Commit

Permalink
Update CI Publish and Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirherobrine23 committed May 12, 2023
1 parent fcd2f2d commit 5086038
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 249 deletions.
20 changes: 0 additions & 20 deletions .devcontainer/Dockerfile

This file was deleted.

62 changes: 0 additions & 62 deletions .devcontainer/devcontainer.json

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/devconatinerTest.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish package
on:
release:
types:
- prereleased
- released

jobs:
publishpackage:
runs-on: ubuntu-latest
name: Publish
permissions:
pull-requests: write
contents: write
issues: write
env:
PACKAGE_VERSION: ${{ github.ref }}
steps:
- uses: actions/checkout@v3
name: Code checkout
with:
persist-credentials: true
ref: main
fetch-depth: 2
submodules: true

# Install basic tools
- uses: actions/setup-node@v3
name: Setup node.js
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/

- name: Edit version and install depencies
run: |
sudo npm i -g semver
VERSION="$(semver -c ${{ github.ref_name }})"
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
jq --arg ver $VERSION '.version = $ver' package.json > package2.json
mv -fv package2.json package.json
# Install depencides and build
npm install --no-save
# Publish npm
- run: npm publish --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
67 changes: 0 additions & 67 deletions .github/workflows/publishNpm.yml

This file was deleted.

108 changes: 33 additions & 75 deletions .github/workflows/testProject.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,43 @@
name: Test
on:
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]
branches:
- main

jobs:
build:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
os: [ubuntu]
runs-on: "${{ matrix.os }}-latest"
name: "Node: ${{ matrix.node-version }}, System: ${{ matrix.os }}"
node_version:
- 14.x
- 16.x
- 18.x
- latest
os:
- ubuntu
- windows
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
name: Code checkout
with:
submodules: true

- uses: actions/setup-node@v3
name: "Setup node.js, version: ${{ matrix.node-version }}"
with:
node-version: ${{ matrix.node-version }}

# Install depenecies and build addon and typescript
- name: Install node depencies and install globaly typescript, mocha and ts-node
run: |
${{ matrix.os != 'windows' && 'sudo ' || '' }}npm install -g ts-node typescript mocha
npm ci
npm run build
# Run tests
- name: Test
run: npm run test${{ matrix.os == 'windows' && ':win' || '' }}

- name: Print route and address
if: matrix.os != 'windows'
continue-on-error: true
run: |
ip addr show sh23Test1235555
ip route show all | grep sh23Test1235555
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- uses: actions/checkout@v3
name: Checkout

- uses: actions/setup-node@v3
name: Setup Node.js
with:
node-version: ${{ matrix.node_version }}

- name: Install dependencies
run: npm install --no-save && ${{ matrix.os == 'ubuntu' && 'sudo ' || '' }}npm install -g ts-node typescript mocha && npm run build

- name: Test
run: npm run test${{ matrix.os == 'windows' && ':win' || '' }}

- name: Print route and address
if: matrix.os == 'ubuntu'
continue-on-error: true
run: |
sudo ip route show all | grep sh23Test1235555
sudo ip addr show sh23Test1235555

0 comments on commit 5086038

Please sign in to comment.