-
Notifications
You must be signed in to change notification settings - Fork 3
158 lines (128 loc) · 3.78 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
name: CI
on:
push:
branches:
- QA
- UAT
- Testnet
- master
pull_request:
branches: [master]
workflow_dispatch:
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
jobs:
# 5irechain linting(fmt + clippy)
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
token: ${{ github.token }}
submodules: recursive
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: webfactory/[email protected]
with:
ssh-private-key: "${{ secrets.READ_DEPLOY_KEY }}"
- name: Install Protobuf
run: sudo apt-get install protobuf-compiler
- name: Check format
run: cargo +nightly fmt --all --check
- name: Add Cargo Clippy
run: rustup component add clippy
- name: Clippy
run: cargo clippy -- -D warnings
# 5irechain cargo check and unit test
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
token: ${{ github.token }}
submodules: recursive
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
targets: wasm32-unknown-unknown
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.9.1'
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: webfactory/[email protected]
with:
ssh-private-key: "${{ secrets.READ_DEPLOY_KEY }}"
- name: Build
run: cargo check
- name: Display Disk Space
run: sudo df -h
- name: Test
run: cargo test
# 5irechain integration tests
e2e:
name: integration-tests
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Code
uses: actions/checkout@v3
- name: Configure sccache
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Restore Cache
if: always()
uses: actions/cache/restore@v3
with:
path: |
~/.cargo/registry
target/release
target/debug
key: ${{ runner.os }}-cargo-index-${{ github.ref_name }}-e2e
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Install Nodejs
uses: actions/setup-node@v3
with:
cache: "yarn"
cache-dependency-path: "./integration-test-suite/yarn.lock"
- name: Install Protobuf
run: sudo apt-get install protobuf-compiler
- name: Install Packages
run: cd integration-test-suite && yarn install --frozen-lockfile
- uses: webfactory/[email protected]
with:
ssh-private-key: "${{ secrets.READ_DEPLOY_KEY }}"
- name: Build Node for Integration Tests (Release)
run: cargo build --release
- name: Run Integration Tests
run: cd integration-test-suite && yarn test
- name: Save Cache
if: ${{ !cancelled() }}
uses: actions/cache/save@v3
with:
path: |
~/.cargo/registry
target/release
target/debug
key: ${{ runner.os }}-cargo-index-${{ github.ref_name }}-integration-tests