|
| 1 | +# This is a Github Workflow that runs tests on any push or pull request. |
| 2 | +# If the tests pass and this is a push to the master branch it also runs Semantic Release. |
| 3 | +name: CI |
| 4 | +on: [push, pull_request] |
| 5 | +jobs: |
| 6 | + push: |
| 7 | + name: Push ${{ github.ref }} |
| 8 | + if: github.event_name == 'push' |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + permissions: |
| 11 | + checks: read |
| 12 | + statuses: write |
| 13 | + contents: write |
| 14 | + packages: write |
| 15 | + id-token: write |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: ${{ github.ref == 'refs/heads/main' && '0' || '1' }} |
| 21 | + |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: 20 |
| 26 | + # cache: 'yarn' |
| 27 | + |
| 28 | + - name: Fetch deps |
| 29 | + run: yarn --mutex network --frozen-lockfile --network-concurrency 25 --silent --disable-self-update-check |
| 30 | + |
| 31 | + - name: Build |
| 32 | + run: yarn build |
| 33 | + |
| 34 | + - name: Run tests |
| 35 | + run: yarn test |
| 36 | + |
| 37 | +# - name: Codeclimate |
| 38 | +# if: github.ref == 'refs/heads/main' |
| 39 | +# uses: paambaati/[email protected] |
| 40 | +# env: |
| 41 | +# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
| 42 | +# with: |
| 43 | +# coverageLocations: | |
| 44 | +# ${{github.workspace}}/target/coverage/lcov.info:lcov |
| 45 | + |
| 46 | +# - name: Semantic Release |
| 47 | +# if: github.ref == 'refs/heads/main' |
| 48 | +# env: |
| 49 | +# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 50 | +# NPM_PROVENANCE: true |
| 51 | +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | +# GIT_BRANCH: 'main' |
| 53 | +# GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} |
| 54 | +# GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} |
| 55 | +# GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} |
| 56 | +# GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} |
| 57 | +# run: npm_config_yes=true npx zx-semrel |
| 58 | + |
| 59 | + pr: |
| 60 | + if: github.event_name == 'pull_request' |
| 61 | + name: PR (Node v${{ matrix.node-version }}, OS ${{ matrix.os }}) |
| 62 | + strategy: |
| 63 | + matrix: |
| 64 | + os: [ ubuntu-22.04 ] |
| 65 | + node-version: [ 20 ] |
| 66 | + |
| 67 | + runs-on: ${{ matrix.os }} |
| 68 | + steps: |
| 69 | + - name: Checkout |
| 70 | + uses: actions/checkout@v4 |
| 71 | + |
| 72 | + - name: Setup Node.js |
| 73 | + uses: actions/setup-node@v4 |
| 74 | + with: |
| 75 | + node-version: ${{ matrix.node-version }} |
| 76 | + cache: 'yarn' |
| 77 | + |
| 78 | + - name: Fetch deps |
| 79 | + run: yarn --mutex network --frozen-lockfile --network-concurrency 25 --silent --disable-self-update-check |
| 80 | + |
| 81 | + - name: Build |
| 82 | + run: yarn build |
| 83 | + |
| 84 | + - name: Run tests |
| 85 | + run: yarn test |
0 commit comments