-
Notifications
You must be signed in to change notification settings - Fork 7
129 lines (113 loc) · 4.55 KB
/
ci-main.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
on:
pull_request:
branches:
- 'main'
name: continuous-integration-main
jobs:
ci:
strategy:
max-parallel: 2
matrix:
rust: [ stable, nightly ]
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: full
# Make sure CI fails on all warnings, including Clippy lints
RUSTFLAGS: "-Dwarnings"
steps:
# - name: Freeing up more disk space
# run: |
# free -h
# sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
# sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
# sudo rm -rf /opt/ghc
# sudo rm -rf /usr/local/share/boost
# sudo rm -rf /opt/hostedtoolcache/CodeQL
# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
# sudo apt-get remove -y 'php.*' --fix-missing
# sudo apt-get remove -y '^mongodb-.*' --fix-missing
# sudo apt-get remove -y '^mysql-.*' --fix-missing
# sudo apt-get clean
# df -h
# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false
- uses: actions/checkout@v2
- name: Install package
run: |
sudo docker image prune --all --force
echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y protobuf-compiler libprotobuf-dev
- name: Setup stable Rust toolchain
if: matrix.rust == 'stable'
# Call `rustup show` as a hack so that the toolchain defined in rust-toolchain.toml is installed
run: rustup show
- name: Use cargo.toml with polkadot-sdk fork
if: matrix.rust == 'nightly'
# To make sure that our polkadot-sdk fork will be used
run: |
rm /home/runner/work/spacewalk/spacewalk/Cargo.toml
mv /home/runner/work/spacewalk/spacewalk/Cargo_CI.toml /home/runner/work/spacewalk/spacewalk/Cargo.toml
- name: Remove rust-toolchain.toml for nightly
if: matrix.rust == 'nightly'
# To make sure that the nightly version will be used all throughout
run: |
rm /home/runner/work/spacewalk/spacewalk/rust-toolchain.toml
- name: Setup nightly Rust toolchain
if: matrix.rust == 'nightly'
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-02-09
components: rustfmt, clippy
target: wasm32-unknown-unknown
- name: Setup nightly Rust as default
if: matrix.rust == 'nightly'
run: rustup default nightly-2024-02-09
- name: Use Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: "ubuntu-latest-cargo-${{ hashFiles('**/Cargo.lock') }}"
shared-key: "shared"
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Build
if: matrix.rust == 'stable'
run: |
bash ./scripts/cmd-all build check "--release"
- name: Test
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
env:
SOURCE_STELLAR_SECRET_MAINNET: ${{ secrets.SOURCE_STELLAR_SECRET_MAINNET }}
SOURCE_STELLAR_SECRET_TESTNET: ${{ secrets.SOURCE_STELLAR_SECRET_TESTNET }}
DEST_STELLAR_SECRET_MAINNET: ${{ secrets.DEST_STELLAR_SECRET_MAINNET }}
DEST_STELLAR_SECRET_TESTNET: ${{ secrets.DEST_STELLAR_SECRET_TESTNET }}
with:
toolchain: nightly-2024-02-09
command: test
args: --release --all --all-features
- name: Rustfmt
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-02-09
command: fmt
args: --all -- --check
- name: Clippy -- Libraries and Binaries
if: matrix.rust == 'stable'
run: |
bash ./scripts/cmd-all clippy "clippy --lib --bins" "--release -- -W clippy::all -A clippy::style -A forgetting_copy_types -A forgetting_references"
- name: Clippy -- Tests and Examples
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-02-09
command: clippy
args: --release --all-features --tests --benches --examples -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references