Skip to content

Commit

Permalink
ci: migrate to github actions (#92)
Browse files Browse the repository at this point in the history
* ci: migrate to github actions

* ci: use commitlint directly

* ci: npm run build

* ci: install dependencies before using commitlint

* ci: fix commitlint command

https://commitlint.js.org/guides/ci-setup.html#github-actions

* chore: upgrade commitlint

* ci: target from base sha

* ci: commitlint fetch-depth=0

* ci: remove commitlint --last
  • Loading branch information
HJunyuan authored Jul 19, 2024
1 parent 1199bf1 commit 29bf76f
Show file tree
Hide file tree
Showing 8 changed files with 637 additions and 1,142 deletions.
36 changes: 0 additions & 36 deletions .circleci/config.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Summary

What is the background of this pull request?

## Changes

- What are the changes made in this pull request?
- Change this and that, etc...

## Issues

What are the related issues or stories?
34 changes: 34 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:

env:
NODE_ENV: ci

name: "Linters"

jobs:
lint:
name: Code Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci --ignore-scripts
- run: npm run lint

commit-lint:
name: Commit Lint
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci --ignore-scripts
- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
29 changes: 29 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
pull_request:
types: [opened, reopened, synchronize]

env:
NODE_ENV: ci

name: "Pull Requests"

jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml

linters:
name: Linters
uses: ./.github/workflows/linters.yml

eslint-review:
name: ESLint Review
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
push:
branches:
- master
- +([0-9])?(.{+([0-9]),x}).x

env:
NODE_ENV: ci

name: Release

jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml

linters:
name: Linters
uses: ./.github/workflows/linters.yml

release:
name: Publish Release
runs-on: ubuntu-latest
needs: [tests, linters]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci && npm run postinstall
- run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_call:

env:
NODE_ENV: ci

name: "Tests"

jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci && npm run postinstall
- run: npm run build
- run: npm run test

test-build:
name: Test Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci && npm run postinstall
- run: npm run build
Loading

0 comments on commit 29bf76f

Please sign in to comment.