Skip to content

Commit 564e4ab

Browse files
committed
ci: PR tests
1 parent 7813075 commit 564e4ab

3 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/pr_tests.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
types: [ labeled ]
6+
branches:
7+
- main
8+
paths:
9+
- 'frontend/**'
10+
- 'backend/**'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
pr-tests:
18+
name: PR Tests
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
cache-dependency-path: ./frontend/package-lock.json
31+
32+
- name: Install frontend dependencies
33+
run: npm ci
34+
working-directory: ./frontend
35+
36+
- name: Build frontend
37+
run: npm run build
38+
working-directory: ./frontend
39+
40+
- uses: nick-fields/retry@v3
41+
with:
42+
timeout_minutes: 5
43+
max_attempts: 3
44+
retry_on: error
45+
command: npm run --prefix ./frontend test
46+
47+
- name: Copy frontend build to backend
48+
run: |
49+
mkdir -p static
50+
cp -r ../frontend/dist/* ./static
51+
working-directory: ./backend
52+
53+
# https://github.com/twistedfall/opencv-rust/blob/master/ci/install-ubuntu.sh#L27
54+
- name: Use clang workaround
55+
run: sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so
56+
57+
- name: Restore Apt packages
58+
uses: awalsh128/cache-apt-pkgs-action@v1
59+
with:
60+
packages: libopencv-dev
61+
version: "1.0"
62+
63+
- name: Install Rust toolchain
64+
uses: dtolnay/rust-toolchain@1.81.0
65+
66+
- name: Restore Rust cache
67+
uses: Swatinem/rust-cache@v2
68+
with:
69+
workspaces: ./backend
70+
71+
- name: Build backend
72+
run: cargo build
73+
working-directory: ./backend
74+
75+
- name: Run backend tests
76+
uses: nick-fields/retry@v3
77+
with:
78+
timeout_minutes: 5
79+
max_attempts: 3
80+
retry_on: error
81+
command: cd ${GITHUB_WORKSPACE}/backend && cargo test

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77
on:
88
release:
99
types: [published]
10+
workflow_dispatch:
1011

1112
env:
1213
CARGO_INCREMENTAL: 0

.github/workflows/release-plz.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- 'backend/**'
1414
- '.github/workflows/release-plz.yml'
1515
# - 'frontend/**' # No point, release-plz only creates new release when Rust code changes.
16+
workflow_dispatch:
1617

1718
jobs:
1819
# Release unpublished packages.

0 commit comments

Comments
 (0)