-
Notifications
You must be signed in to change notification settings - Fork 337
188 lines (177 loc) · 6.4 KB
/
ci.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule: [cron: "40 1 * * *"]
permissions:
contents: read
jobs:
pre_ci:
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
test:
name: ${{matrix.name || format('Rust {0}', matrix.rust)}}
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
rust: [nightly, beta, stable, 1.82.0, 1.74.0, 1.73.0]
os: [ubuntu]
include:
- name: Cargo on macOS
rust: nightly
os: macos
- name: Cargo on Windows (msvc)
rust: nightly-x86_64-pc-windows-msvc
os: windows
flags: /EHsc
env:
CXXFLAGS: ${{matrix.flags}}
RUSTFLAGS: --cfg deny_warnings -Dwarnings
timeout-minutes: 45
steps:
- name: Enable symlinks (windows)
if: matrix.os == 'windows'
run: git config --global core.symlinks true
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rust-src
- name: Determine test suite subset
# Our Windows and macOS jobs are the longest running, so exclude the
# relatively slow compiletest from them to speed up end-to-end CI time,
# except during cron builds when no human is presumably waiting on the
# build. The extra coverage is not particularly valuable and we can
# still ensure the test is kept passing on the basis of the scheduled
# builds.
run: |
echo RUSTFLAGS=$RUSTFLAGS >> $GITHUB_ENV
echo exclude=--exclude cxx-test-suite ${{matrix.rust == '1.73.0' && '--exclude cxxbridge-cmd' || ''}} >> $GITHUB_OUTPUT
env:
RUSTFLAGS: ${{env.RUSTFLAGS}} ${{matrix.os != 'ubuntu' && github.event_name != 'schedule' && '--cfg skip_ui_tests' || ''}}
id: testsuite
shell: bash
- run: cargo run --manifest-path demo/Cargo.toml
- run: cargo test --workspace ${{steps.testsuite.outputs.exclude}}
- run: cargo check --no-default-features --features alloc
env:
RUSTFLAGS: --cfg compile_error_if_std ${{env.RUSTFLAGS}}
- run: cargo check --no-default-features
env:
RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}}
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu' && matrix.rust == 'nightly' && always()
with:
name: Cargo.lock
path: Cargo.lock
continue-on-error: true
reindeer:
name: Reindeer
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
- uses: dtolnay/install@reindeer
- run: reindeer buckify
working-directory: third-party
- name: Check reindeer-generated BUCK file up to date
run: git diff --exit-code
bazel:
name: Bazel on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
runs-on: ${{matrix.os}}-latest
if: github.event_name != 'pull_request'
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Install lld
run: sudo apt-get install lld
if: matrix.os == 'ubuntu'
- run: bazel --version
- run: bazel run demo --verbose_failures --noshow_progress ${{matrix.os == 'macos' && '--xcode_version_config=tools/bazel:github_actions_xcodes' || ''}}
continue-on-error: ${{matrix.os == 'windows'}} # https://github.com/bazelbuild/bazel/issues/18592
- run: bazel test ... --verbose_failures --noshow_progress ${{matrix.os == 'macos' && '--xcode_version_config=tools/bazel:github_actions_xcodes' || ''}}
continue-on-error: ${{matrix.os == 'windows'}} # https://github.com/bazelbuild/bazel/issues/18592
- name: Check MODULE.bazel.lock up to date
run: git diff --exit-code
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
- run: bazel run //third-party:vendor
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
- name: Check third-party/bazel up to date
run: git diff --exit-code
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
minimal:
name: Minimal versions
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo generate-lockfile -Z minimal-versions
- run: cargo check --locked --workspace
doc:
name: Documentation
needs: pre_ci
if: needs.pre_ci.outputs.continue
runs-on: ubuntu-latest
timeout-minutes: 45
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: dtolnay/install@cargo-docs-rs
- run: cargo docs-rs
- run: cargo docs-rs -p cxx-build
- run: cargo docs-rs -p cxx-gen
- run: cargo docs-rs -p cxxbridge-flags
- run: cargo docs-rs -p cxxbridge-macro
clippy:
name: Clippy
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rust-src
- run: cargo clippy --workspace --tests --exclude demo -- -Dclippy::all -Dclippy::pedantic
- run: cargo clippy --manifest-path demo/Cargo.toml -- -Dclippy::all
clang-tidy:
name: Clang Tidy
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Install clang-tidy
run: sudo apt-get install clang-tidy-11
- name: Run clang-tidy
run: clang-tidy-11 src/cxx.cc --warnings-as-errors=*
outdated:
name: Outdated
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/install@cargo-outdated
- run: cargo outdated --workspace --exit-code 1