From fbbb52e46346d4f2bd6a0ddd01eb4e1956a69c61 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 9 Sep 2022 08:55:04 -0400 Subject: [PATCH] build: improve github workflows --- .github/workflows/coverage.yml | 46 ++++++++++++++++++++++++++ .github/workflows/linter.yml | 40 ++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 13 +++----- 3 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/linter.yml rename .github/workflows/{ci.yml => test.yml} (87%) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..e6bd754 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,46 @@ +name: coverage + +on: + push: + branches: + - main + pull_request: + branches: + - main + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v3 + + - uses: pnpm/action-setup@v2.2.2 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: true + + - name: Install dependencies + run: pnpm install --ignore-scripts + + - name: Coverage + run: pnpm run test:coverage + + - name: Upload Coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..819551b --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,40 @@ +name: linter + +on: + push: + branches: + - main + pull_request: + branches: + - main + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v3 + + - uses: pnpm/action-setup@v2.2.2 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: true + + - name: Install dependencies + run: pnpm install --ignore-scripts + + - name: Linter + run: pnpm run format:ci diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 87% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 4a0ff60..d198896 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: ci +name: test on: push: @@ -14,12 +14,12 @@ concurrency: cancel-in-progress: true jobs: - test: - runs-on: ubuntu-latest + build: strategy: matrix: node-version: [14, 16, 18] os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} permissions: contents: read steps: @@ -30,7 +30,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 'lts/*' + node-version: ${{ matrix.node-version }} - uses: pnpm/action-setup@v2.2.2 name: Install pnpm @@ -42,10 +42,5 @@ jobs: - name: Install dependencies run: pnpm install --ignore-scripts - - name: Linter - run: pnpm run format:ci - - name: Test run: pnpm test - -