Skip to content

Commit 740d886

Browse files
chore: Add test workflow for opened PRs
1 parent 711c7a3 commit 740d886

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run Tests and Check Coverage
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Checkout the code
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
# Set up Node.js
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: "18"
22+
23+
# Cache yarn dependencies (optional but speeds up the process)
24+
- name: Cache yarn dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/yarn
28+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-yarn-
31+
32+
# Install dependencies with yarn
33+
- name: Install dependencies with yarn
34+
run: yarn install
35+
36+
# Run tests
37+
- name: Run tests
38+
run: yarn test
39+
40+
# Run coverage
41+
- name: Run coverage
42+
run: yarn coverage
43+
44+
# Upload coverage results (using Coveralls or another service)
45+
- name: Upload coverage to coveralls
46+
uses: coverallsapp/github-action@v2
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)