Skip to content

Commit 8eec20b

Browse files
committed
chore(ci): move ci to github actions
- move all related CI-CD workflows from circleci to github actions
1 parent 8a4ac67 commit 8eec20b

5 files changed

Lines changed: 158 additions & 28 deletions

File tree

.github/actions/ci/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
description: Shared action to install dependencies
4+
5+
runs:
6+
using: composite
7+
8+
steps:
9+
- name: Read .nvmrc
10+
id: nvm
11+
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
12+
shell: bash
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
16+
with:
17+
node-version-file: ".nvmrc"
18+
cache: "yarn"
19+
20+
# Whenever on a changeset versioning PR
21+
# Then installing can not fail with lockfile changes
22+
# Because the package.json for integration test changes.
23+
24+
- name: Install
25+
run: yarn install --immutable
26+
shell: bash

.github/workflows/docs.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ on:
66
event:
77
description: "TypeDoc deploy"
88
required: true
9-
permissions: {}
9+
10+
permissions:
11+
pages: write # to deploy to Pages
12+
id-token: write
1013

1114
jobs:
1215
# Build job
@@ -29,11 +32,7 @@ jobs:
2932
# Deploy job
3033
deploy:
3134
runs-on: ubuntu-latest
32-
needs: build
33-
34-
permissions:
35-
pages: write # to deploy to Pages
36-
id-token: write # to verify the deployment originates from an appropriate source
35+
needs: build # to verify the deployment originates from an appropriate source
3736

3837
# Deploy to the github-pages environment
3938
environment:

.github/workflows/qa.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Qa
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- '!changeset-release/**'
8+
9+
pull_request:
10+
11+
jobs:
12+
immutable-install:
13+
if: ${{ !startsWith(github.ref, 'refs/heads/changeset-release/') }}
14+
name: Immutable Install
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
21+
- name: Setup
22+
uses: ./.github/actions/ci
23+
24+
# The shared install action does not respect the
25+
# `--immutable` flag, so we need to run it here.
26+
- name: Install with lockfile
27+
run: yarn install --immutable
28+
29+
linting:
30+
if: ${{ !startsWith(github.ref, 'refs/heads/changeset-release/') }}
31+
name: Linting
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
38+
- name: Setup
39+
uses: ./.github/actions/ci
40+
41+
- name: Lint
42+
run: yarn format
43+
44+
type-checking:
45+
if: ${{ !startsWith(github.ref, 'refs/heads/changeset-release/') }}
46+
name: Type checking
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52+
53+
- name: Setup
54+
uses: ./.github/actions/ci
55+
56+
- name: TypeScript
57+
run: yarn typecheck
58+
59+
testing:
60+
if: ${{ !startsWith(github.ref, 'refs/heads/changeset-release/') }}
61+
name: Testing
62+
needs: [immutable-install, linting, type-checking]
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
69+
- name: Setup
70+
uses: ./.github/actions/ci
71+
72+
- name: Build
73+
run: yarn build
74+
75+
- uses: oNaiPs/secrets-to-env-action@ec46a22bfc9b37e014b627b3208b07eb8909ea0f # v1.5
76+
with:
77+
secrets: ${{ toJSON(secrets) }}
78+
79+
- name: Test (Examples)
80+
run: cd examples;yarn test
81+
82+
- name: Test (Unit)
83+
run: yarn test:unit
84+
85+
- name: Test (Integration)
86+
run: yarn test --coverage
87+
88+
- name: Upload Coverage Report
89+
uses: codecov/codecov-action@v5 #2db07e317924c76f654a414629d71c65876882e2 v5.4.3
90+
with:
91+
file: coverage/clover.xml
92+
token: ${{ secrets.CODECOV_TOKEN }}
93+
flags: test-coverage
94+
95+
regression-testing:
96+
if: ${{ !startsWith(github.ref, 'refs/heads/changeset-release/') }}
97+
name: Regression Testing
98+
needs: [testing]
99+
runs-on: ubuntu-latest
100+
strategy:
101+
matrix:
102+
version: [18, 20]
103+
fail-fast: true
104+
max-parallel: 1
105+
106+
steps:
107+
- name: Checkout
108+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
109+
110+
- name: Setup
111+
uses: ./.github/actions/ci
112+
113+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
114+
with:
115+
node-version: ${{ matrix.version }}
116+
117+
- name: Build
118+
run: yarn build
119+
120+
- uses: oNaiPs/secrets-to-env-action@ec46a22bfc9b37e014b627b3208b07eb8909ea0f # v1.5
121+
with:
122+
secrets: ${{ toJSON(secrets) }}
123+
124+
- name: Integration tests
125+
run: yarn test

.github/workflows/release.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,8 @@ jobs:
3838
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
3939
token: ${{ steps.generate_github_token.outputs.token }}
4040

41-
- name: Read .nvmrc
42-
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
43-
id: nvm
44-
45-
- name: Setup Node (uses version in .nvmrc)
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
49-
50-
- name: Get yarn cache
51-
id: yarn-cache
52-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
53-
54-
- uses: actions/cache@v4
55-
with:
56-
path: ${{ steps.yarn-cache.outputs.dir }}
57-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
58-
restore-keys: |
59-
${{ runner.os }}-yarn-
60-
61-
- name: Install dependencies
62-
run: yarn install --frozen-lockfile
41+
- name: Setup
42+
uses: ./.github/actions/ci
6343

6444
- name: Creating .npmrc
6545
run: |

0 commit comments

Comments
 (0)