Skip to content

Commit d4ff8b6

Browse files
authored
Migrate to GitHub Actions (changesets#1085)
* Migrate to GitHub Actions * Include the install step in all jobs * add missing shell param in the composite action * Pass `--color` to Jest * Bring back setting up a mock git user * Bump `codecov/codecov-action` * limit push runs * drop the prepare-cache step * add ci-ok job * update codecov action
1 parent 620f367 commit d4ff8b6

File tree

6 files changed

+96
-189
lines changed

6 files changed

+96
-189
lines changed

.circleci/config.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Setup CI
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Setup Node.js 20.x
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version: 20.x
10+
cache: yarn
11+
12+
- name: Install dependencies
13+
shell: bash
14+
run: yarn install --frozen-lockfile

.github/workflows/changeset-version.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ jobs:
1212
name: Release
1313
if: github.repository == 'changesets/changesets'
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 20
1516
steps:
16-
- name: Checkout Repo
17-
# https://github.com/actions/checkout
18-
uses: actions/checkout@v4
19-
20-
- name: Setup Node.js 20.x
21-
# https://github.com/actions/setup-node
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: 20.x
25-
26-
- name: Install Dependencies
27-
run: yarn
17+
- uses: actions/checkout@v4
18+
- uses: ./.github/actions/ci-setup
2819

2920
- name: Create Release Pull Request or Publish to npm
3021
# https://github.com/changesets/action

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 20
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: ./.github/actions/ci-setup
19+
20+
- name: Check Git version
21+
run: git --version
22+
23+
- name: Setup mock Git user
24+
run: git config --global user.email "you@example.com" && git config --global user.name "Your Name"
25+
26+
- name: Jest tests
27+
run: yarn jest --ci --color --runInBand --coverage --reporters=default --reporters=jest-junit
28+
29+
- name: Upload coverage
30+
uses: codecov/codecov-action@v4
31+
32+
typecheck:
33+
name: Typecheck
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 20
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: ./.github/actions/ci-setup
39+
40+
- name: Typecheck
41+
run: yarn types:check
42+
43+
lint:
44+
name: Lint
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 20
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: ./.github/actions/ci-setup
50+
51+
- name: Lint
52+
run: yarn lint
53+
54+
ci-ok:
55+
name: CI OK
56+
runs-on: ubuntu-latest
57+
if: always()
58+
needs: [test, typecheck, lint]
59+
env:
60+
FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }}
61+
steps:
62+
- name: Check for failure
63+
run: |
64+
echo $FAILURE
65+
if [ "$FAILURE" = "false" ]; then
66+
exit 0
67+
else
68+
exit 1
69+
fi

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"@types/semver": "^7.5.0",
5252
"@typescript-eslint/eslint-plugin": "^5.43.0",
5353
"@typescript-eslint/parser": "^5.43.0",
54-
"codecov": "^3.6.5",
5554
"eslint": "^8.28.0",
5655
"eslint-config-prettier": "^8.5.0",
5756
"eslint-config-standard": "^17.0.0",

0 commit comments

Comments
 (0)