Skip to content

Commit

Permalink
ci: add bun to test matrix, measure coverage, enable CC reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Nov 17, 2023
1 parent c6fcc02 commit 05e51c5
Show file tree
Hide file tree
Showing 5 changed files with 671 additions and 936 deletions.
76 changes: 36 additions & 40 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: ${{ github.ref == 'refs/heads/master' && '0' || '1' }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -20,9 +22,30 @@ jobs:
run: npm i

- name: Run tests
run: npm run test
run: npm run test:cov

- name: Codeclimate
if: github.ref == 'refs/heads/master'
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/coverage/lcov.info:lcov
test_pr:
- name: Semantic Release
if: github.ref == 'refs/heads/master'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PROVENANCE: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
run: npm_config_yes=true npx zx-semrel

pr_node:
if: ${{ github.event_name == 'pull_request' }}
name: Test PR (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
strategy:
Expand Down Expand Up @@ -50,49 +73,22 @@ jobs:
timeout-minutes: 2
run: npm test

release:
name: Release
# https://github.community/t/trigger-job-on-tag-push-only/18076
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: test_push
pr_bun:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-22.04

permissions:
checks: read
statuses: write
contents: write
packages: write

name: PR with Bun
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install deps
run: npm i
- name: Setup Bun
uses: antongolub/action-setup-bun@v1

- name: Create .npmrc
- name: Deps
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
bun install
ln -s ../ ./node_modules/zx-extra
- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
run: npm_config_yes=true npx zx-semrel
# run: |
# npm link
# zx-extra https://raw.githubusercontent.com/semrel-extra/zx-semrel/0df9ee72ccaddae156e821a340806d49307b963c/release.mjs
- name: Run tests
timeout-minutes: 2
run: bun run test:bun
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Requirements
* Node.js >= 16.0.0
* Bun >= 1.0.12

## Install
```shell
Expand Down
Loading

0 comments on commit 05e51c5

Please sign in to comment.