Skip to content

Commit b07c857

Browse files
CI: run npm run test on pull requests in existing workflow (Acode-Foundation#2697)
* Initial plan * Add PR-only unit test job to CI workflow Co-authored-by: UnschooledGamer <76094069+UnschooledGamer@users.noreply.github.com> * Set read-only token permissions for unit test job Co-authored-by: UnschooledGamer <76094069+UnschooledGamer@users.noreply.github.com> * Update CI workflow to trigger on main branch only Restrict CI workflow to run on pushes to the main branch. * Update ci.yml --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: UnschooledGamer <76094069+UnschooledGamer@users.noreply.github.com>
1 parent 341c027 commit b07c857

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
8+
branches:
9+
- '**'
610
merge_group:
711

812
jobs:
@@ -13,7 +17,7 @@ jobs:
1317

1418
steps:
1519
- name: Checkout Actions Repository
16-
uses: actions/checkout@v7
20+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1721

1822
- name: Check spelling
1923
uses: crate-ci/typos@master
@@ -27,14 +31,37 @@ jobs:
2731

2832
steps:
2933
- name: Checkout repository
30-
uses: actions/checkout@v7
34+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3135

3236
- name: Setup Biome
33-
uses: biomejs/setup-biome@v2
37+
uses: biomejs/setup-biome@4c91541eaada48f67d7dbd7833600ce162b68f51 # v2.7.1
3438

3539
- name: Run Biome
3640
run: biome ci .
3741

42+
unit-tests:
43+
name: Unit Tests (On PR Only)
44+
timeout-minutes: 10
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: read
48+
if: github.event_name == 'pull_request'
49+
steps:
50+
- name: Checkout Repository
51+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52+
53+
- name: Use Node.js
54+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
55+
with:
56+
cache: npm
57+
cache-dependency-path: '**/package-lock.json'
58+
59+
- name: Install dependencies
60+
run: npm ci --no-audit --no-fund
61+
62+
- name: Run unit tests
63+
run: npm run test
64+
3865
translation-check:
3966
name: Translation Check (On PR Only)
4067
timeout-minutes: 5
@@ -45,9 +72,9 @@ jobs:
4572
if: github.event_name == 'pull_request'
4673
steps:
4774
- name: Checkout Repository
48-
uses: actions/checkout@v7
75+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4976
- name: Use Node.js
50-
uses: actions/setup-node@v7
77+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
5178
with:
5279
cache: npm
5380
cache-dependency-path: '**/package-lock.json'

0 commit comments

Comments
 (0)