Skip to content

Commit

Permalink
chore: fix PK env vars passed to cross builds
Browse files Browse the repository at this point in the history
Also uses `cargo-binstall` to use pre-compiled `cross` and `just`
binaries to speed up the workflow.
  • Loading branch information
b-zee committed Jul 2, 2024
1 parent 19fb1cb commit 0686df0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ on:
required: true
default: main

# Copied from `release.yml`
# During the build step, the env variable has to be manually sent to the containers for cross platform builds.
# Update the Justfile as well.
env:
RELEASE_PLZ_BIN_URL: https://github.com/MarcoIeni/release-plz/releases/download/release-plz-v0.3.43/release-plz-x86_64-unknown-linux-gnu.tar.gz
JUST_BIN_URL: https://github.com/casey/just/releases/download/1.25.2/just-1.25.2-x86_64-unknown-linux-musl.tar.gz
WORKFLOW_URL: https://github.com/maidsafe/safe_network/actions/runs
GENESIS_PK: ${{ secrets.STABLE_GENESIS_PK }}
GENESIS_SK: ${{ secrets.STABLE_GENESIS_SK }}
FOUNDATION_PK: ${{ secrets.STABLE_FOUNDATION_PK }}
NETWORK_ROYALTIES_PK: ${{ secrets.STABLE_NETWORK_ROYALTIES_PK }}
PAYMENT_FORWARD_PK: ${{ secrets.STABLE_REWARD_FORWARDING_PK }}

jobs:
build:
Expand All @@ -36,9 +46,10 @@ jobs:
with:
ref: ${{ inputs.branch }}
- uses: dtolnay/rust-toolchain@stable
# It's quite slow to install just by building it, but here we need a cross-platform solution.
# cargo-binstall will try and use pre-built binaries if they are available (also speeds up installing `cross`)
- uses: cargo-bins/cargo-binstall@main
- shell: bash
run: cargo install just
run: cargo binstall --no-confirm just

- shell: bash
run: just build-release-artifacts "${{ matrix.target }}"
Expand Down
9 changes: 5 additions & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ build-release-artifacts arch:
cargo clean

echo "Using the keys: GENESIS_PK=$GENESIS_PK, FOUNDATION_PK=$FOUNDATION_PK, NETWORK_ROYALTIES_PK=$NETWORK_ROYALTIES_PK, PAYMENT_FORWARD_PK=$PAYMENT_FORWARD_PK"
cross_container_opts="--env GENESIS_PK=$GENESIS_PK,GENESIS_SK=$GENESIS_SK,FOUNDATION_PK=$FOUNDATION_PK,NETWORK_ROYALTIES_PK=$NETWORK_ROYALTIES_PK,PAYMENT_FORWARD_PK=$PAYMENT_FORWARD_PK"
cross_container_opts="--env GENESIS_PK=$GENESIS_PK --env GENESIS_SK=$GENESIS_SK --env FOUNDATION_PK=$FOUNDATION_PK --env NETWORK_ROYALTIES_PK=$NETWORK_ROYALTIES_PK --env PAYMENT_FORWARD_PK=$PAYMENT_FORWARD_PK"
if [[ -n "${NETWORK_VERSION_MODE+x}" ]]; then
echo "The NETWORK_VERSION_MODE variable is set to $NETWORK_VERSION_MODE"
cross_container_opts="$cross_container_opts,NETWORK_VERSION_MODE=$NETWORK_VERSION_MODE"
cross_container_opts="$cross_container_opts --env NETWORK_VERSION_MODE=$NETWORK_VERSION_MODE"
fi
export CROSS_CONTAINER_OPTS=$cross_container_opts
export CROSS_CONTAINER_OPTS=$cross_container_opts

if [[ $arch == arm* || $arch == armv7* || $arch == aarch64* ]]; then
cargo install cross
echo "Passing to cross CROSS_CONTAINER_OPTS=$CROSS_CONTAINER_OPTS"
cargo binstall --no-confirm cross
cross build --release --target $arch --bin faucet --features=distribution
cross build --release --target $arch --bin nat-detection
cross build --release --target $arch --bin node-launchpad
Expand Down

0 comments on commit 0686df0

Please sign in to comment.