-
Notifications
You must be signed in to change notification settings - Fork 4
89 lines (74 loc) · 2.03 KB
/
rust.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
name: rust
on:
push:
branches:
- main
tags:
- "*"
pull_request:
types: [opened, synchronize]
paths-ignore:
- "*.json"
- "*.md"
- "LICENSE"
merge_group:
paths-ignore:
- "*.json"
- "*.md"
- "LICENSE"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cargo-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: test-db
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
steps:
- uses: actions/checkout@v3
- name: install dependencies (ubuntu only)
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libsodium-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "debug"
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo check
- run: cargo clippy
- run: cargo test
env:
TEST_DATABASE_URL: "postgres://postgres:postgres@localhost/test-db"
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
name: cargo-deny (${{ matrix.checks }})
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v3
# check if cargo.lock changed
# only needed in advisories
- uses: dorny/paths-filter@v2
id: lock
with:
filters: |
src:
- '**/Cargo.lock'
if: ${{ matrix.checks == 'advisories' }}
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
# conditionally run advisories only if lock changed
if: ${{ matrix.checks != 'advisories' || steps.lock.outputs.src == 'true' }}