This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (135 loc) · 5.2 KB
/
push.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Rust checks and tests
on:
push:
paths-ignore:
- '**.md'
- '.gitignore'
pull_request:
paths-ignore:
- '**.md'
- '.gitignore'
workflow_dispatch:
inputs:
test-macos:
description: 'Whether to run macOS tests'
required: true
default: false
type: boolean
concurrency:
group: push-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Not needed in CI, should make things a bit faster
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
MAX_TARGET_SIZE: 1024 # MB
RUSTFLAGS: -C debuginfo=0
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1
with:
version: "15.0"
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
- name: Add cache
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: |
~/.cargo/registry
~/.cargo/bin
~/.cargo/git
target
key: clippy-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: clippy-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Install utils for caching
run: |
test -x ~/.cargo/bin/cargo-sweep || cargo install cargo-sweep
test -x ~/.cargo/bin/cargo-cache || cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
- name: Clean unused crate source checkouts and git repo checkouts
run: cargo cache
- uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --locked -- -D warnings
- name: Clean unused artifacts
run: cargo sweep --maxsize ${{ env.MAX_TARGET_SIZE }}
test:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
run-all:
- ${{ inputs.test-macos || github.ref == 'refs/heads/master' }}
exclude: # exclude macos-12 when the condition is false
- run-all: false
os: macos-12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1
with:
version: "15.0"
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
- name: Add cache
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
if: runner.os != 'Windows'
with:
path: |
~/.cargo/registry
~/.cargo/bin
~/.cargo/git
target
key: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Install utils for caching
if: runner.os != 'Windows'
run: |
test -x ~/.cargo/bin/cargo-sweep || cargo install cargo-sweep
test -x ~/.cargo/bin/cargo-cache || cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
- name: Clean unused crate source checkouts and git repo checkouts
if: runner.os != 'Windows'
run: cargo cache
- name: Build and run tests
run: cargo test --locked --test integration --release -- --test-threads=1 --nocapture
- name: Clean unused artifacts
if: runner.os != 'Windows'
run: cargo sweep --maxsize ${{ env.MAX_TARGET_SIZE }}
docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
- name: Check Documentation
run: cargo doc --locked --no-deps --lib
env:
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"