-
Notifications
You must be signed in to change notification settings - Fork 45
138 lines (115 loc) · 4.01 KB
/
build.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
name: Build IPC
# This workflow is triggered from the main CI workflow.
on:
workflow_call:
jobs:
build:
name: Build IPC
runs-on: ubuntu-22.04
env:
RUST_BACKTRACE: full
RUSTFLAGS: -Dwarnings
steps:
# https://github.com/marketplace/actions/free-disk-space-ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false
swap-storage: false
docker-images: false
android: true
dotnet: true
haskell: true
- name: Check out the project
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Tools
uses: ./.github/actions/install-tools
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
rust: 1.81.0
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 18.19.0
- uses: Swatinem/rust-cache@v2
with:
## Share the cache between jobs. If we don't set this, each job will have its own cache.
shared-key: build
- name: Cache Solidity ABI artifacts
uses: actions/cache@v4
with:
path: |
./contracts/out
./contract-bindings
./contracts/cache
## TODO maybe add the rust version and solc version to the key
key: v2-contracts-abi-${{ hashFiles('./contracts/**/*.sol') }}
- name: Generate ABI and bindings
run: cd contracts && make gen
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-07-05
components: rustfmt,clippy
- name: Print Rust toolchain default versions
run: |
echo "rustup show:"
rustup show
echo "rustc version:"
rustc --version
echo "cargo version:"
cargo -V
echo "glibc version"
ldd --version
- name: Check fmt (nightly)
run: cargo +nightly-2024-07-05 fmt --check --all
- name: Check clippy
run: cargo clippy --release --tests --no-deps -- -D clippy::all
- name: Build all (including tests, benches, examples)
run: |
cd fendermint && make $PWD/builtin-actors/output/bundle.car
cargo build --locked --release --all-targets
- name: Build Docker image for e2e tests
run: |
## Create the temporary Dockerfile.
cat <<EOF > /tmp/Dockerfile
# syntax=docker/dockerfile:1
FROM alpine as builder
COPY /fendermint/app/config /app/fendermint/app/config
COPY /target/release/fendermint /app/output/bin/fendermint
COPY /target/release/ipc-cli /app/output/bin/ipc-cli
EOF
## Append the runner build phase to the Dockerfile.
cat fendermint/docker/runner.Dockerfile >> /tmp/Dockerfile
## Print the Dockerfile for debugging.
echo "Dockerfile:"
cat /tmp/Dockerfile
## Create the temporary .dockerignore file.
cat <<EOF > /tmp/Dockerfile.dockerignore
target
!target/release/fendermint
!target/release/ipc-cli
contracts/cache
contracts/node-modules
EOF
## Print the .dockerignore file for debugging.
echo "Dockerfile.dockerignore:"
cat /tmp/Dockerfile.dockerignore
## Build the Docker image.
DOCKER_BUILDKIT=1 docker build \
--load \
-f /tmp/Dockerfile \
-t fendermint:latest \
.
- name: Create artifacts directory
run: mkdir -p /tmp/artifacts
- name: Export Docker image
run: docker save fendermint:latest > /tmp/artifacts/docker-image.tar
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docker-image
path: /tmp/artifacts/docker-image.tar