-
Notifications
You must be signed in to change notification settings - Fork 122
90 lines (80 loc) · 2.28 KB
/
test.yaml
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
name: Tests
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
env:
CARGO_TERM_COLOR: always
jobs:
changes:
name: Get Changes
runs-on: ubuntu-latest
outputs:
ui: ${{ steps.filter.outputs.ui }}
other: ${{ steps.filter.outputs.other }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ui:
- 'server/ui/**'
other:
- '!server/ui/**'
- '**'
- '!docs/**'
lint:
name: Lint Checks
needs: changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
if: ${{ needs.changes.outputs.ui == 'true' }}
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Npm Install
if: ${{ needs.changes.outputs.ui == 'true' }}
run: cd server/ui && npm ci
- name: UI Lint Check
if: ${{ needs.changes.outputs.ui == 'true' }}
run: cd server/ui && npm run lint
- name: Setup Rust
if: ${{ needs.changes.outputs.other == 'true' }}
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
override: true
- name: Rust Format Check
if: ${{ needs.changes.outputs.other == 'true' }}
run: |
cd server/
cargo +nightly fmt -- --check
test:
name: Run Tests
needs: changes
if: ${{ needs.changes.outputs.other == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update APT package list
run: sudo apt-get update || true # skip errors as temp workaround for https://github.com/tensorlakeai/indexify/actions/runs/8814655533/job/24194983960#step:3:33
- name: Install protoc
run: sudo apt install -y protobuf-compiler npm
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Test
run: ./run_tests.sh
- name: Clear up space
run: |
docker stop --time 90 $(docker ps -aq) || true
docker rm --force $(docker ps -aq) || true
docker rmi --force $(docker images -aq) || true