Skip to content

Commit 46c07ca

Browse files
committed
chore: setup common ci process
1 parent c9476ce commit 46c07ca

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# should be optimize as increment build & test
2+
name: CI
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
include:
15+
- NodeVersion: 20.9.x
16+
NodeVersionDisplayName: 20
17+
OS: ubuntu-latest
18+
name: Node.js v${{ matrix.NodeVersionDisplayName }} (${{ matrix.OS }})
19+
runs-on: ${{ matrix.OS }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 1
24+
25+
- name: Config Git User
26+
# should be turn to ci user
27+
run: |
28+
git config --local user.name "tecvan"
29+
git config --local user.email "[email protected]"
30+
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.NodeVersion }}
34+
35+
- name: Install Dependencies
36+
run: node common/scripts/install-run-rush.js install
37+
38+
- name: Build
39+
run: node common/scripts/install-run-rush.js build --verbose
40+
41+
- name: Ts check
42+
run: node common/scripts/install-run-rush.js ts-check --verbose
43+
44+
- name: Test:cov
45+
run: node common/scripts/install-run-rush.js test:cov --verbose
46+
47+
- name: Upload coverage reports
48+
uses: codecov/codecov-action@v4
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
fail_ci_if_error: true
52+
verbose: true
53+
54+
- name: Lint
55+
# for current stage, we got so much lint error, so we have to ignore it
56+
# TODO: it should be fixed ASAP
57+
continue-on-error: true
58+
run: node common/scripts/install-run-rush.js lint --verbose
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PR Common Checks
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, reopened]
5+
6+
jobs:
7+
common-checks:
8+
name: PR Common Checks
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 1
14+
15+
- name: Config Git User
16+
run: |
17+
git config --local user.name "tecvan"
18+
git config --local user.email "[email protected]"
19+
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 20.9.x
23+
24+
- name: Install Dependencies
25+
run: node common/scripts/install-run-rush.js install
26+
27+
# PR Title Format Check
28+
- name: Check PR Title Format
29+
if: ${{ !contains(github.event.pull_request.title, 'WIP') && !contains(github.event.pull_request.title, 'wip') }}
30+
env:
31+
PR_TITLE: ${{ github.event.pull_request.title }}
32+
run: |
33+
node common/scripts/install-run-rush.js update-autoinstaller --name rush-commitlint && \
34+
pushd common/autoinstallers/rush-commitlint && \
35+
echo "$PR_TITLE" | npx commitlint --config commitlint.config.js && \
36+
popd
37+
38+
# Add more common checks here
39+
# For example: file size checks, specific file format validations, etc.

0 commit comments

Comments
 (0)