-
-
Notifications
You must be signed in to change notification settings - Fork 3
89 lines (73 loc) · 2.44 KB
/
Copy pathci.yml
File metadata and controls
89 lines (73 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: CI
on:
push:
branches:
# This is to make sure that there is no broken CI on
# the main branch, and also for Sonarqube integration
- main
# We need it for better Sonarqube integration
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
permissions:
contents: read
# The maximum number of minutes to let a workflow run
# before GitHub automatically cancels it. Default: 360
timeout-minutes: 30
concurrency:
# Cancel any currently running job or workflow in the same concurrency group.
# The group is a unique identifier for the workflow run.
#
# Explanation:
# - github.workflow: The name of the workflow (e.g. Workflow 1).
# - github.event.pull_request.number: The number of the pull request (when the trigger event is a PR).
# - github.ref: The branch name (when the trigger is not a PR but a push).
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: npm
- name: Install dependencies
run: npm ci --include=dev
- name: Run prettier
run: npm run format:check
- name: Run linter
run: npm run lint
- name: Run type check
run: npm run typecheck
- name: Audit packages
run: npm audit --omit=dev --audit-level=high
- name: Run unit tests
run: npm run test:coverage -- --verbose
- name: Upload code coverage
if: ${{ !cancelled() && success() }}
uses: codecov/codecov-action@v7
with:
directory: coverage
report_type: coverage
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() && success() }}
uses: codecov/codecov-action@v7
with:
report_type: test_results
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Success Reporting
if: ${{ !cancelled() && success() }}
run: |
echo "CI succeeded. Recent commits:"
git log -5 --oneline