-
-
Notifications
You must be signed in to change notification settings - Fork 198
142 lines (120 loc) · 4.41 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
name: CI
on: pull_request
jobs:
tests:
strategy:
fail-fast: false
matrix:
rust_version: [stable]
platform:
# Windows
- { id: windows, target: x86_64-pc-windows-msvc, os: windows-latest }
# Ubuntu with default features
- { id: ubuntu, target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
# Ubuntu without features
- {
id: ubuntu-without-feat,
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
options: --no-default-features,
}
# macOS
- { id: macos, target: x86_64-apple-darwin, os: macos-latest }
# Android on Ubuntu
- {
id: android,
target: aarch64-linux-android,
os: ubuntu-latest,
cmd: "apk --",
}
# iOS on Ubuntu
- { id: ios, target: aarch64-apple-ios, os: macos-latest }
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0"
OPTIONS: ${{ matrix.platform.options }}
FEATURES: ${{ format(',{0}', matrix.platform.features ) }}
CMD: ${{ matrix.platform.cmd }}
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- name: Cache cargo folder
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }}
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.rust_version }}
- name: Install Gtk (ubuntu only)
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
- name: Install ayatana-libappindicator (ubuntu[default/tray] only)
if: matrix.platform.id == 'ubuntu'
run: |
sudo apt-get install -y libayatana-appindicator3-dev
- name: Install GCC Multilib
if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')
run: sudo apt-get install gcc-multilib
- name: Install cargo-apk
if: contains(matrix.platform.target, 'android')
run: cargo install cargo-apk
- name: Check documentation
shell: bash
run: cargo $CMD doc --no-deps --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
- name: Build
shell: bash
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
- name: Build tests
shell: bash
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
- name: Run tests
shell: bash
if: (
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios'))
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
- name: Build with all features enabled
shell: bash
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
- name: Build tests with all features enabled
shell: bash
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
- name: Run tests with all features enabled
shell: bash
if: (
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios'))
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
test_tao_macros:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo folder
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Run tests
shell: bash
run: cargo test --package tao-macros --examples
fmt:
name: fmt check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: fmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check