From a3b3449382b83bb7763aecdfe92c8367e7fae8ea Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 24 May 2025 22:14:17 -0500 Subject: [PATCH] chore: add workflows --- .github/workflows/publish.yml | 29 +++++++++++ .github/workflows/pull_request.yml | 78 ++++++++++++++++++++++++++++++ vitest.config.ts | 3 +- 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..18c84a6 --- /dev/null +++ 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 \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..ece71ae --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,78 @@ +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 }} \ No newline at end of file diff --git a/vitest.config.ts b/vitest.config.ts index f050a77..9333db4 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,9 +6,8 @@ export default defineConfig({ environment: 'node', coverage: { provider: 'istanbul', - reporter: ['text', 'html', 'json', 'lcov'], + reporter: ['text', 'html', 'json', 'lcov', 'cobertura'], include: ['**/src/**/*.ts'], - exclude: ['**/src/index.ts'], }, }, plugins: [swc.vite()],