-
-
Notifications
You must be signed in to change notification settings - Fork 46
55 lines (52 loc) · 1.68 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: build and test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
check_versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
jsr_version=$(jq -r '.version' jsr.json)
pkg_version=$(jq -r '.version' package.json)
if [[ "$jsr_version" != "$pkg_version" ]]; then
echo "Version Mismatch"
echo "JSR: $jsr_version"
echo "Node: $pkg_version"
exit 1
fi
build:
runs-on: ubuntu-latest
needs: [check_versions]
strategy:
matrix:
node-version: [ 18.x, 20.x ]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install --frozen-lockfile --production false
- run: pnpm test:cov
env:
CI: true
DOMAIN: localhost
JWT_SECRET: testing-access-token-secret
- name: report coverage to code climate
# code coverage report will only run on the main branch and not on pull request
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter format-coverage -t lcov coverage/lcov.info
./cc-test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}