-
Notifications
You must be signed in to change notification settings - Fork 5
118 lines (102 loc) · 2.81 KB
/
osrd-ui-build.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build osrd-ui
on:
pull_request:
workflow_dispatch:
merge_group:
types: [checks_requested]
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Build project
run: |
npm ci
npm run build
- name: Check code linting
run: |
if ! npm run lint; then
echo "Linting failed"
exit 1
fi
check_commits:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Check commit names
run: |
# We don't have a base ref to check against if we aren't in a
# pull_request workflow.
BASE=${{ github.base_ref }}
if [[ -z "$BASE" ]]; then
exit 0
fi
commit_titles() {
git log --format=%s origin/"$BASE"..HEAD --skip=1
}
commit_titles | TERM=xterm-color .github/scripts/check-commit-titles.sh
final_newline_lint:
runs-on: ubuntu-latest
name: Check final newline
steps:
- name: Install ripgrep
run: sudo apt-get install -y ripgrep
- name: Checkout
uses: actions/checkout@v4
- name: Check final newline is present
run: |
# search missing final newline
if rg -Ul '[^\n]\z' -g '!*.svg' .; then
echo "Found missing final newline on listed file(s)"
exit 1
fi
# search multiple final newlines
if rg -Ul '\n\n\z' .; then
echo "Found multiple final newlines on listed file(s)"
exit 1
fi
check_unit_tests:
runs-on: ubuntu-latest
name: Check unit tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install vitest
run: npm install vitest
- name: Check tests
run: |
if ! npm run test; then
echo "Tests failed"
exit 1
fi
check_reuse_compliance:
runs-on: ubuntu-latest
name: Check REUSE Compliance
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v5
check_dco:
runs-on: ubuntu-latest
name: Check DCO
steps:
- name: DCO Compliance Check
uses: christophebedard/dco-check@0.5.0
with:
args: --exclude-emails '49699333+dependabot[bot]@users.noreply.github.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}