From ff37a2dabe887b5fc5f46faa5758e3dc8aa4fd83 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Mon, 12 May 2025 21:49:25 -0500 Subject: [PATCH] chore: add workflows --- .github/workflows/publish.yml | 29 +++++++++++ .github/workflows/pull_request.yml | 79 ++++++++++++++++++++++++++++++ package.json | 7 ++- 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e69de29..218a9fb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish +on: + workflow_dispatch: + push: + branches: + - main + paths-ignore: + - '.github/**/*' + - '**/.gitignore' +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: https://registry.npmjs.org/ + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} + run: npx semantic-release diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e69de29..a9d234e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,79 @@ +name: Pull Request +on: + workflow_dispatch: + pull_request: + branches: + - main +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install + - name: Lint code + run: npm run lint + format: + name: Format + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm install + - name: Format code + run: npm run format + test: + name: test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x, 22.x, 23.x, 24.x] + fail-fast: false + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm install + - name: Run test coverage and tests + run: npm run test:ci + - name: Upload test coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.node-version }} + path: ./coverage + publish_coverage: + name: Publish Coverage + runs-on: ubuntu-latest + needs: test + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Download test coverage artifact + uses: actions/download-artifact@v4 + with: + name: coverage-24.x + path: ./coverage + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + diff --git a/package.json b/package.json index bfd5025..4f3f934 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "tsc --project tsconfig.build.json", "test": "vitest", - "test:ci": "vitest --run", + "test:ci": "vitest --run --coverage", "test:coverage": "vitest --coverage", "test:ui": "vitest --ui --api 9527", "lint": "eslint . --ext .ts", @@ -17,6 +17,9 @@ "publishConfig": { "access": "public" }, + "engines": { + "node": ">=18.0.0" + }, "files": [ "dist", "LICENSE.md", @@ -37,7 +40,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/StevanFreeborn/netdi.git" + "url": "https://github.com/StevanFreeborn/netdi.git" }, "homepage": "https://github.com/StevanFreeborn/netdi", "bugs": {