-
Notifications
You must be signed in to change notification settings - Fork 19
203 lines (192 loc) · 6.46 KB
/
rust.yaml
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
SGX_SDK_URL: https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu18.04-server/sgx_linux_x64_sdk_2.12.100.3.bin
SGX_SDK_INSTALLER: /tmp/sgxsdk_installer
SGX_SDK_DEST: /opt
jobs:
format:
name: Format
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-06-16
default: true
profile: minimal
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
build_and_test:
name: Build and Test
runs-on: ubuntu-18.04
env:
SCCACHE_TAR_URL: https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz
SCCACHE_CACHE_SIZE: "1G"
steps:
- uses: actions/checkout@v2
- name: Setup environment variables for subsequent steps
run: |
echo "$HOME/.local/bin/" >> $GITHUB_PATH
echo "SCCACHE=$HOME/.local/bin/sccache" >> $GITHUB_ENV
- uses: actions/cache@v2
id: cache-sccache
with:
path: |
${{ env.SCCACHE }}
key: ${{ runner.os }}-sccache-${{ env.SCCACHE_TAR_URL }}
- uses: actions/cache@v2
id: cache-cargo
with:
# The paths are taken from
# https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-
- uses: actions/cache@v2
id: cache-sgx
with:
path: |
${{ env.SGX_SDK_DEST }}/sgxsdk
key: ${{ runner.os }}-sgx-${{ env.SGX_SDK_URL }}
- uses: actions/cache@v2
id: cache-sccache-local-disk
with:
path: |
~/.cache/sccache
key: ${{ runner.os }}-sccache-local-disk-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-local-disk-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-sccache-local-disk
- name: Install sccache
if: steps.cache-sccache.outputs.cache-hit != 'true'
id: install-sccache
run: |
curl -LsSf ${SCCACHE_TAR_URL} > /tmp/sccache.tar.gz
mkdir -p $(dirname $SCCACHE)
tar axvf /tmp/sccache.tar.gz --strip-components=1 -C $(dirname $SCCACHE) --wildcards --no-anchored 'sccache'
chmod +x ${SCCACHE}
sccache --version
sccache -s
- name: Install Intel SGX SDK
if: steps.cache-sgx.outputs.cache-hit != 'true'
run: |
curl -LsSf ${SGX_SDK_URL} > ${SGX_SDK_INSTALLER}
chmod +x ${SGX_SDK_INSTALLER}
echo -e 'no\n${SGX_SDK_DEST}' | ${SGX_SDK_INSTALLER}
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-06-16
target: wasm32-unknown-unknown
default: true
profile: minimal
- name: Build for FiniteState
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: build
args: --workspace --features finitestate
- name: Check sccache status
run: sccache -s
- name: Build for ContextFree
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: build
args: --workspace --features contextfree
- name: Check sccache status
run: sccache -s
- name: Build for Automata
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: build
args: --workspace --features automata
- name: Check sccache status
run: sccache -s
- name: Test for FiniteState
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: test
args: --workspace --features finitestate
- name: Check sccache status
run: sccache -s
- name: Test for ContextFree
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: test
args: --workspace --features contextfree
- name: Check sccache status
run: sccache -s
- name: Test for Automata
uses: actions-rs/cargo@v1
env:
RUSTC_WRAPPER: ${{ env.SCCACHE }}
# disable incremental compilation to increase sccache hit rate
CARGO_INCREMENTAL: "0"
with:
command: test
args: --workspace --features automata
- name: Check sccache status
run: sccache -s
clippy:
name: Clippy
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: cache-sgx
with:
path: |
${{ env.SGX_SDK_DEST }}/sgxsdk
key: ${{ runner.os }}-sgx-${{ env.SGX_SDK_URL }}
- name: Install Intel SGX SDK
if: steps.cache-sgx.outputs.cache-hit != 'true'
run: |
curl -LsSf ${SGX_SDK_URL} > ${SGX_SDK_INSTALLER}
chmod +x ${SGX_SDK_INSTALLER}
echo -e 'no\n${SGX_SDK_DEST}' | ${SGX_SDK_INSTALLER}
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-06-16
components: clippy
target: wasm32-unknown-unknown
profile: minimal
default: true
- uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: clippy
args: --workspace -- -D warnings