Repository navigation
111 lines (102 loc) · 4.23 KB
/
Copy pathci.yml
File metadata and controls
111 lines (102 loc) · 4.23 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: CI
# macOS and Windows are slow: pushes to main test on every platform, pull requests on Linux, plus
# macOS when labelled `ci:macos`, Windows (x64 and ARM64) when labelled `ci:windows`, and both for
# `ci:full`.
# Adding the label runs that platform straight away (ci-label.yml); later pushes include it here.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
lint:
name: Lint (pre-commit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
# Only main saves the cache (see test-rust.yml).
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: "3.12"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
wasm:
name: Web app (wasm32)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
# Only main saves the cache (see test-rust.yml).
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build for the browser
run: cargo build --locked --target wasm32-unknown-unknown -p rustgis-web
# Every dependency's licence must be one the project accepts (deny.toml). The third-party
# notices the packages ship (`cargo xtask notices`) only warn here when out of date, since
# Dependabot can't regenerate them; the release build requires them current.
licenses:
name: Licences
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
# Only main saves the cache (see test-rust.yml).
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: taiki-e/install-action@c509219cf42fba86913069efd0ade2458c59337b # v2
with:
tool: cargo-deny,cargo-about@0.9.2
- name: Cargo source replacements
run: |
python3 -m unittest discover -s .github/scripts -p 'test_*.py'
python3 .github/scripts/check-cargo-sources.py
- name: Dependency licences and sources
run: cargo deny --locked check licenses sources
- name: Third-party notices
# Exit code 2 is stale notices (a warning); anything else (cargo-about failing, a licence
# it can't work out) fails the job.
run: |
status=0
cargo xtask notices --check || status=$?
if [ "$status" -eq 2 ]; then
echo "::warning::THIRD-PARTY-LICENSES.txt is out of date: run cargo xtask notices and commit it before the next release."
elif [ "$status" -ne 0 ]; then
exit "$status"
fi
plan:
name: Platforms
runs-on: ubuntu-latest
outputs:
os: ${{ steps.os.outputs.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
sparse-checkout: .github/scripts
- id: os
env:
EVENT: ${{ github.event_name }}
ACTION: ${{ github.event.action }}
LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: echo "os=$(.github/scripts/platforms.sh)" >> "$GITHUB_OUTPUT"
test:
needs: plan
uses: ./.github/workflows/test-rust.yml
with:
os: ${{ needs.plan.outputs.os }}
# The release build runs nightly; `ci:full` asks for it before merging.
release-build: ${{ contains(github.event.pull_request.labels.*.name, 'ci:full') }}