Skip to content

Commit

Permalink
Migrate to GitHub Actions (changesets#1085)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Andarist authored May 22, 2024
1 parent 620f367 commit d4ff8b6
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 189 deletions.
83 changes: 0 additions & 83 deletions .circleci/config.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup CI

runs:
using: composite
steps:
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn

- name: Install dependencies
shell: bash
run: yarn install --frozen-lockfile
15 changes: 3 additions & 12 deletions .github/workflows/changeset-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@ jobs:
name: Release
if: github.repository == 'changesets/changesets'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout Repo
# https://github.com/actions/checkout
uses: actions/checkout@v4

- name: Setup Node.js 20.x
# https://github.com/actions/setup-node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install Dependencies
run: yarn
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Create Release Pull Request or Publish to npm
# https://github.com/changesets/action
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Check Git version
run: git --version

- name: Setup mock Git user
run: git config --global user.email "[email protected]" && git config --global user.name "Your Name"

- name: Jest tests
run: yarn jest --ci --color --runInBand --coverage --reporters=default --reporters=jest-junit

- name: Upload coverage
uses: codecov/codecov-action@v4

typecheck:
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Typecheck
run: yarn types:check

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Lint
run: yarn lint

ci-ok:
name: CI OK
runs-on: ubuntu-latest
if: always()
needs: [test, typecheck, lint]
env:
FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }}
steps:
- name: Check for failure
run: |
echo $FAILURE
if [ "$FAILURE" = "false" ]; then
exit 0
else
exit 1
fi
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"codecov": "^3.6.5",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
Expand Down
Loading

0 comments on commit d4ff8b6

Please sign in to comment.