-
-
Notifications
You must be signed in to change notification settings - Fork 9
112 lines (97 loc) · 2.74 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
name: ci
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '00 00 * * *'
defaults:
run:
shell: bash
env:
# Coloured output from Cargo.
CARGO_TERM_COLOR: always
# Emit backtraces on panics.
RUST_BACKTRACE: 1
jobs:
test:
name: ${{ format('test ({0})', matrix.name || matrix.rust) }}
runs-on: ${{ format('{0}-latest', matrix.os || 'ubuntu') }}
env:
# We use cross to test on 32-bit and big-endian systems.
CARGO: cargo
# When CARGO is set to `cross`, TARGET is set to `--target matrix.target`.
TARGET: ''
strategy:
matrix:
rust:
- 1.53.0
- stable
- beta
- nightly
include:
- rust: nightly
name: macos
os: macos
- rust: nightly-x86_64-msvc
name: windows-msvc
os: windows
- rust: nightly-x86_64-gnu
name: windows-gnu
os: windows
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
- name: Use Cross
if: ${{ matrix.target != '' }}
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
- name: Show command used for Cargo
run: |
echo "cargo command: ${{ env.CARGO }}"
echo "target flag: ${{ env.TARGET }}"
- name: Build
run: ${{ env.CARGO }} build --verbose --workspace ${{ env.TARGET }}
- name: Build (unstable)
if: ${{ startsWith(matrix.rust, 'nightly') }}
run: ${{ env.CARGO }} build --verbose --workspace --features unstable ${{ env.TARGET }}
- name: Run tests
run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET }}
- name: Run tests (unstable)
if: ${{ startsWith(matrix.rust, 'nightly') }}
run: ${{ env.CARGO }} test --verbose --workspace --features unstable ${{ env.TARGET }}
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
# Collect jobs required for CI success.
success:
name: ci pass
if: ${{ success() }}
runs-on: ubuntu-latest
needs:
- test
- rustfmt
steps:
- name: Mark the job as successful
run: exit 0