Skip to content

Commit 256450a

Browse files
raulkgalargh
andauthored
add support for butterflynet and calibrationnet parameters; push bundles for all networks (#205)
* add support for butterflynet and calibrationnet parameters. * ci: extract cargo run out of ci workflow (#210) * ci: produce bundles for all networks. Bundles are uploaded as GitHub assets, and to Estuary as well. Co-authored-by: Piotr Galar <[email protected]>
1 parent 93a646c commit 256450a

File tree

9 files changed

+124
-152
lines changed

9 files changed

+124
-152
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: rust cargo run
2+
description: Rust Cargo Run
3+
4+
inputs:
5+
command:
6+
description: The cargo command to execute
7+
required: true
8+
args:
9+
description: The arguments to provide for the cargo command
10+
required: false
11+
components:
12+
description: The components to include when installing Rust
13+
required: false
14+
save_cache:
15+
description: Whether to save the SSCACHE
16+
required: false
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Installing Rust
22+
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
23+
with:
24+
profile: minimal
25+
target: wasm32-unknown-unknown
26+
override: true
27+
components: ${{ inputs.components }}
28+
- name: Setting up cache
29+
uses: pl-strflt/rust-sccache-action@v1
30+
env:
31+
SCCACHE_CACHE_SIZE: 2G
32+
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
33+
CACHE_SKIP_SAVE: ${{ inputs.save_cache == '' || inputs.save_cache == 'false' }}
34+
with:
35+
version: v0.2.15
36+
shared-key: v1 # change this to invalidate sccache for this job
37+
- name: Running ${{ inputs.command }}
38+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
39+
env:
40+
CARGO_INCREMENTAL: '0'
41+
with:
42+
command: ${{ inputs.command }}
43+
args: ${{ inputs.args }}

.github/actions/rust-sccache/action.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -10,82 +10,82 @@ jobs:
1010
rustfmt:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checking out fvm
13+
- name: Checking out
1414
uses: actions/checkout@v2
15-
- name: Installing Rust
16-
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
17-
with:
18-
profile: minimal
19-
override: true
20-
components: rustfmt
21-
- name: Running fmt
22-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
15+
- name: Running rustfmt
16+
uses: ./.github/actions/rust-cargo-run
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2319
with:
2420
command: fmt
2521
args: -- --check
26-
cargo:
22+
components: rustfmt
23+
24+
check-clippy:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checking out
28+
uses: actions/checkout@v2
29+
- name: Running clippy
30+
uses: ./.github/actions/rust-cargo-run
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
command: clippy
35+
args: --all --all-targets
36+
components: clippy
37+
38+
test:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checking out
42+
uses: actions/checkout@v2
43+
- name: Running tests
44+
uses: ./.github/actions/rust-cargo-run
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
command: test
49+
args: --all
50+
51+
build:
2752
runs-on: ubuntu-latest
28-
strategy:
29-
matrix:
30-
include:
31-
- name: check-clippy
32-
command: clippy
33-
args: --all --all-targets
34-
components: clippy
35-
- name: test
36-
command: test
37-
args: --all
38-
- name: build
39-
command: build
40-
push: true
4153
env:
42-
SCCACHE_CACHE_SIZE: 2G
43-
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
4454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4555
CARGO_INCREMENTAL: 0
4656
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
47-
name: ${{ matrix.name }}
57+
strategy:
58+
matrix:
59+
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet' ]
4860
steps:
49-
- name: Checking out builtin-actors
61+
- name: Checking out
5062
uses: actions/checkout@v2
63+
- name: Install Rust toolchain
64+
uses: ./.github/actions/rust-cargo-run
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5167
with:
52-
submodules: ${{ matrix.submodules }}
53-
- name: Installing Rust
54-
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
55-
with:
56-
profile: minimal
57-
target: wasm32-unknown-unknown
58-
override: true
59-
components: ${{ matrix.components }}
60-
# we don't check the lockfile in; this is needed for cache restoration/saving
61-
- name: Generating Cargo.lock
62-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
63-
with:
64-
command: generate-lockfile
65-
- name: Setting up cache
66-
uses: ./.github/actions/rust-sccache
67-
with:
68-
version: v0.2.15
69-
# change this to invalidate sccache for this job
70-
shared-key: v1
71-
- name: Running ${{ matrix.command }}
72-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
73-
with:
74-
command: ${{ matrix.command }}
75-
args: ${{ matrix.args }}
76-
- name: make bundle
77-
if: ${{ matrix.command == 'build' }}
68+
command: version
69+
- name: Making bundle
70+
env:
71+
BUILD_FIL_NETWORK: ${{ matrix.network }}
7872
run: ./build-bundle.sh
79-
- name: upload bundle
80-
if: ${{ matrix.command == 'build' }}
73+
- name: Uploading bundle to Estuary
8174
env:
8275
ESTUARY_TOKEN: ${{ secrets.ESTUARY_TOKEN }}
83-
run: ./upload-bundle.sh
84-
- name: Publishing build artifacts to github
85-
if: ${{ matrix.command == 'build' }}
76+
run: |
77+
BUNDLE_PATH="output/builtin-actors.car"
78+
UPLOAD_AS="builtin-actors-${{ matrix.network }}.car"
79+
curl -k -X POST -F "data=@${BUNDLE_PATH};type=application/octet-stream;filename=\"${UPLOAD_AS}\"" \
80+
-H "Authorization: Bearer $ESTUARY_TOKEN" \
81+
-H "Content-Type: multipart/form-data" \
82+
https://shuttle-4.estuary.tech/content/add > output/upload.json
83+
cat output/upload.json
84+
shasum -a 256 "$BUNDLE_PATH" > "$BUNDLE_PATH".sha256sum
85+
- name: Publishing build artifacts to GitHub
8686
uses: actions/upload-artifact@v2
8787
with:
88-
name: bundle
88+
name: bundle-${{ matrix.network }}
8989
path: |
9090
output/builtin-actors.car
9191
output/builtin-actors.car.sha256sum

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ fil_actors_runtime = { version = "8.0.0-alpha.1", path = "./actors/runtime", fea
2727
fil_actor_bundler = "3.0.0"
2828
cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] }
2929

30-
3130
[features]
32-
default = []
31+
default = [] ## translates to mainnet
32+
mainnet = []
3333
caterpillarnet = []
34+
butterflynet = []
35+
calibrationnet = []
3436
devnet = []
3537

3638
[workspace]

actors/power/src/state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ pub fn consensus_miner_min_power(p: RegisteredPoStProof) -> anyhow::Result<Stora
417417
2 << 10
418418
} else if cfg!(feature = "min-power-2g") {
419419
2 << 30
420+
} else if cfg!(feature = "min-power-32g") {
421+
32 << 30
420422
} else {
421423
10 << 40
422424
};

actors/runtime/build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
static NETWORKS: &[(&str, &[&str])] = &[
2-
("default", &["sector-32g", "sector-64g"]),
2+
("mainnet", &["sector-32g", "sector-64g"]),
33
(
44
"caterpillarnet",
55
&[
@@ -11,6 +11,8 @@ static NETWORKS: &[(&str, &[&str])] = &[
1111
"min-power-2g",
1212
],
1313
),
14+
("butterflynet", &["sector-512m", "sector-32g", "sector-64g", "min-power-2g"]),
15+
("calibrationnet", &["sector-32g", "sector-64g", "min-power-32g"]),
1416
("devnet", &["sector-2k", "sector-8m", "small-deals", "short-precommit", "min-power-2k"]),
1517
];
1618
const NETWORK_ENV: &str = "BUILD_FIL_NETWORK";
@@ -19,7 +21,7 @@ fn main() {
1921
let network = std::env::var(NETWORK_ENV).ok();
2022
println!("cargo:rerun-if-env-changed={}", NETWORK_ENV);
2123

22-
let network = network.as_deref().unwrap_or("default");
24+
let network = network.as_deref().unwrap_or("mainnet");
2325
let features = NETWORKS.iter().find(|(k, _)| k == &network).expect("unknown network").1;
2426
for feature in features {
2527
println!("cargo:rustc-cfg=feature=\"{}\"", feature);

build-bundle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -e
44

55
bundle=$(cargo build 2>&1 | grep "warning: bundle=" | cut -d = -f 2)
6-
cp -v $bundle output/builtin-actors.car
6+
cp -v "$bundle" output/builtin-actors.car

build.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,30 @@ const NETWORK_ENV: &str = "BUILD_FIL_NETWORK";
3333
fn network_name() -> String {
3434
let env_network = std::env::var_os(NETWORK_ENV);
3535

36-
let cfg_network = if cfg!(feature = "caterpillarnet") {
36+
let feat_network = if cfg!(feature = "mainnet") {
37+
Some("mainnet")
38+
} else if cfg!(feature = "caterpillarnet") {
3739
Some("caterpillarnet")
40+
} else if cfg!(feature = "butterflynet") {
41+
Some("butterflynet")
42+
} else if cfg!(feature = "calibrationnet") {
43+
Some("calibrationnet")
3844
} else if cfg!(feature = "devnet") {
3945
Some("devnet")
4046
} else {
4147
None
4248
};
4349

44-
// Make sure they match if they're both set. Otherwise, pick the one that's set, or fallback on
45-
// "default".
46-
match (cfg_network, &env_network) {
50+
// Make sure they match if they're both set. Otherwise, pick the one
51+
// that's set, or fallback on "mainnet".
52+
match (feat_network, &env_network) {
4753
(Some(from_feature), Some(from_env)) => {
4854
assert_eq!(from_feature, from_env, "different target network configured via the features than via the {} environment variable", NETWORK_ENV);
4955
from_feature
5056
}
5157
(Some(net), None) => net,
5258
(None, Some(net)) => net.to_str().expect("network name not utf8"),
53-
(None, None) => "default",
59+
(None, None) => "mainnet",
5460
}.to_owned()
5561
}
5662

upload-bundle.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)