-
Notifications
You must be signed in to change notification settings - Fork 707
113 lines (91 loc) · 3.87 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
name: ci
permissions:
contents: read
on:
pull_request:
push:
jobs:
test:
# Don't run duplicate `push` jobs for the repo owner's PRs.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.host_os }}
strategy:
matrix:
# XXX: See `test-features` below.
features:
- # Default
target:
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu
mode:
- # debug
- --release
rust_channel:
- stable
# Keep in sync with Cargo.toml and similar `rust_channel` sections.
- 1.61.0 # MSRV
# TODO: Move these to a daily/pre-release job.
# - nightly
# - beta
include:
- target: x86_64-pc-windows-gnu
host_os: windows-latest
- target: x86_64-pc-windows-msvc
host_os: windows-latest
- target: x86_64-apple-darwin
host_os: macos-12
- target: x86_64-unknown-linux-musl
host_os: ubuntu-22.04
- target: x86_64-unknown-linux-gnu
host_os: ubuntu-22.04
steps:
- if: ${{ contains(matrix.host_os, 'ubuntu') }}
run: sudo apt-get update -y
- uses: briansmith/actions-checkout@v2
with:
persist-credentials: false
- if: ${{ !contains(matrix.host_os, 'windows') }}
run: mk/install-build-tools.sh --target=${{ matrix.target }} ${{ matrix.features }}
- if: ${{ contains(matrix.host_os, 'windows') }}
run: ./mk/install-build-tools.ps1
- uses: briansmith/actions-rs-toolchain@v1
with:
override: true
target: ${{ matrix.target }}
toolchain: ${{ matrix.rust_channel }}
- if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }}
run: |
echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
shell: bash
- if: ${{ !contains(matrix.host_os, 'linux') }}
run: |
cat /proc/cpuinfo | grep "^flags" | head -n1
- if: ${{ !contains(matrix.host_os, 'macos') }}
run: |
sysctl -a | grep machdep.cpu.features
- if: ${{ !contains(matrix.host_os, 'windows') }}
run: |
mk/cargo.sh test -vv --all-targets --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }} -- --nocapture
- if: ${{ contains(matrix.host_os, 'windows') }}
run: |
cargo test -vv --all-targets --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }}
# --all-targets doesn't run doctests: https://github.com/rust-lang/cargo/issues/6669
# Run doctests only on x86_64 to avoid cross-compilation hassles with `--no-run`.
- if: ${{ !contains(matrix.host_os, 'windows') && contains(matrix.target, 'x86_64') }}
run: |
mk/cargo.sh test -vv --doc --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.features }} ${{ matrix.mode }}
# Check that all the needed symbol renaming was done.
# TODO: Do this check on Windows too.
# TODO: Check iOS too.
# TODO: Do this on Apple-hosted release builds too; currently these fail with:
# Unknown attribute kind (528)
# (Producer: 'LLVM12.0.0-rust-1.54.0-nightly'
# Reader: 'LLVM APPLE_1_1200.0.32.29_0')
- if: ${{ matrix.target != 'aarch64-apple-ios' &&
!contains(matrix.host_os, 'windows') &&
(!contains(matrix.host_os, 'macos') || matrix.mode != '--release') }}
run: mk/check-symbol-prefixes.sh --target=${{ matrix.target }}