Skip to content

Commit

Permalink
Merge branch '2024-07-23.alpha.1' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
jacderida committed Jul 25, 2024
2 parents b1e0cc9 + 0db3dd0 commit 6fb9e27
Show file tree
Hide file tree
Showing 82 changed files with 3,656 additions and 1,446 deletions.
81 changes: 38 additions & 43 deletions .github/workflows/build-release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: build release artifacts
# This workflow builds and packages the release artifacts, without actually running a release.
#
# It can sometimes be useful to obtain these binaries built from other branches, or a tag, or when
# the release process is being updated, this workflow can be used to test some of the changes.
#
# The built and packaged binaries will be attached to the workflow run as artifacts, available for
# download.
name: build and package release artifacts

on:
workflow_dispatch:
inputs:
branch:
description: The branch to build.
description: Set to build a particular branch
type: string
tag:
description: The tag to build.
description: Set to build a particular tag
type: string

# 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.
# The key variables also need to be passed to `cross`, which runs in a container and does not
# inherit variables from the parent environment. The `cross` tool is used in the `build`
# job. If any keys are added, the `build-release-artifacts` target in the Justfile must
# also be updated.
env:
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 }}
Expand All @@ -33,6 +39,8 @@ jobs:
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
Expand All @@ -46,8 +54,6 @@ jobs:
with:
ref: ${{ inputs.tag || inputs.branch }}
- uses: dtolnay/rust-toolchain@stable
# cargo-binstall will try and use pre-built binaries if they are available and also speeds up
# installing `cross`
- uses: cargo-bins/cargo-binstall@main
- shell: bash
run: cargo binstall --no-confirm just
Expand All @@ -61,21 +67,14 @@ jobs:
artifacts
!artifacts/.cargo-lock
# This job isn't necessary, but it's useful for debugging the packaging process for the real release
# workflow, just in case any issues are ever encountered there.
package:
name: publish and release
name: package artifacts
runs-on: ubuntu-latest
needs: [build]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DEPLOY_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-2
needs: [ build ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
token: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
ref: ${{ inputs.tag || inputs.branch }}
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-pc-windows-msvc
Expand All @@ -84,6 +83,10 @@ jobs:
with:
name: safe_network-x86_64-unknown-linux-musl
path: artifacts/x86_64-unknown-linux-musl/release
- uses: actions/download-artifact@master
with:
name: safe_network-aarch64-apple-darwin
path: artifacts/aarch64-apple-darwin/release
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-apple-darwin
Expand All @@ -100,32 +103,24 @@ jobs:
with:
name: safe_network-aarch64-unknown-linux-musl
path: artifacts/aarch64-unknown-linux-musl/release
# It's possible to `cargo install` just, but it's very slow to compile on GHA infra.
# Therefore we just pull the binary from the Github Release.
- name: install just
- uses: cargo-bins/cargo-binstall@main
- shell: bash
run: cargo binstall --no-confirm just

- name: package binaries
shell: bash
run: |
curl -L -O $JUST_BIN_URL
mkdir just
tar xvf just-1.25.2-x86_64-unknown-linux-musl.tar.gz -C just
rm just-1.25.2-x86_64-unknown-linux-musl.tar.gz
sudo mv just/just /usr/local/bin
rm -rf just
sudo apt-get install -y tree
- name: package artifacts
just package-all-bins
- uses: actions/upload-artifact@main
with:
name: packaged_binaries
path: packaged_bins

- name: package architectures
shell: bash
run: |
tree artifacts
just package-release-assets "faucet"
just package-release-assets "nat-detection"
just package-release-assets "node-launchpad"
just package-release-assets "safe"
just package-release-assets "safenode"
just package-release-assets "safenode_rpc_client"
just package-release-assets "safenode-manager"
just package-release-assets "safenodemand"
just package-release-assets "sn_auditor"
just package-all-architectures
- uses: actions/upload-artifact@main
with:
name: packaged_binaries
path: deploy
name: packaged_architectures
path: packaged_architectures
6 changes: 4 additions & 2 deletions .github/workflows/memcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
# on main, we want to know that all commits are passing at a glance, any deviation should help bisecting errors
# the merge run checks should show on master and enable this clear test/passing history
merge_group:
branches: [main, alpha*, beta*, rc*]
branches: [ main, alpha*, beta*, rc* ]
pull_request:
branches: ["*"]
branches: [ "*" ]

env:
SAFE_DATA_PATH: /home/runner/.local/share/safe
Expand Down Expand Up @@ -100,6 +100,7 @@ jobs:
- name: Create and fund a wallet to pay for files storage
run: |
echo "Obtaining address for use with the faucet..."
./target/release/safe --log-output-dest=data-dir wallet create --no-password
address=$(./target/release/safe --log-output-dest=data-dir wallet address | tail -n 1)
echo "Sending tokens to the faucet at $address"
./target/release/faucet --log-output-dest=data-dir send 5000000 $address > initial_balance_from_faucet.txt
Expand Down Expand Up @@ -171,6 +172,7 @@ jobs:
mv $SAFE_DATA_PATH/client_first/logs $CLIENT_DATA_PATH/logs
ls -l $CLIENT_DATA_PATH
cp ./the-test-data.zip ./the-test-data_1.zip
./target/release/safe --log-output-dest=data-dir wallet create --no-replace --no-password
./target/release/faucet --log-output-dest=data-dir send 5000000 $(./target/release/safe --log-output-dest=data-dir wallet address | tail -n 1) > initial_balance_from_faucet_1.txt
cat initial_balance_from_faucet_1.txt
cat initial_balance_from_faucet_1.txt | tail -n 1 > transfer_hex
Expand Down
84 changes: 76 additions & 8 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
# on main, we want to know that all commits are passing at a glance, any deviation should help bisecting errors
# the merge run checks should show on master and enable this clear test/passing history
merge_group:
branches: [main, alpha*, beta*, rc*]
branches: [ main, alpha*, beta*, rc* ]
pull_request:
branches: ["*"]
branches: [ "*" ]

env:
CARGO_INCREMENTAL: 0 # bookkeeping for incremental builds has overhead, not useful in CI.
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -207,6 +207,7 @@ jobs:

- name: Create and fund a wallet to pay for files storage
run: |
./target/release/safe --log-output-dest=data-dir wallet create --no-password
./target/release/faucet --log-output-dest=data-dir send 1000000 $(./target/release/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 > transfer_hex
./target/release/safe --log-output-dest=data-dir wallet receive --file transfer_hex
env:
Expand Down Expand Up @@ -341,7 +342,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4

Expand All @@ -359,7 +360,7 @@ jobs:
timeout-minutes: 30

- name: Build testing executable
run: cargo test --release -p sn_node --features=local-discovery --test sequential_transfers --test storage_payments --test double_spend --test spend_simulation --no-run
run: cargo test --release -p sn_node --features=local-discovery --test sequential_transfers --test storage_payments --test double_spend --no-run
env:
# only set the target dir for windows to bypass the linker issue.
# happens if we build the node manager via testnet action
Expand Down Expand Up @@ -406,8 +407,69 @@ jobs:
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 25

- name: Stop the local network and upload logs
if: always()
uses: maidsafe/sn-local-testnet-action@main
with:
action: stop
log_file_prefix: safe_test_logs_spend
platform: ${{ matrix.os }}

# runs with increased node count
spend_simulation:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
name: spend simulation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Build binaries
run: cargo build --release --features=local-discovery --bin safenode
timeout-minutes: 30

- name: Build faucet binary
run: cargo build --release --bin faucet --features="local-discovery,gifting"
timeout-minutes: 30

- name: Build testing executable
run: cargo test --release -p sn_node --features=local-discovery --test spend_simulation --no-run
env:
# only set the target dir for windows to bypass the linker issue.
# happens if we build the node manager via testnet action
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 30

- name: Start a local network
uses: maidsafe/sn-local-testnet-action@main
with:
action: start
interval: 2000
node-count: 50
node-path: target/release/safenode
faucet-path: target/release/faucet
platform: ${{ matrix.os }}
build: true

- name: Check SAFE_PEERS was set
shell: bash
run: |
if [[ -z "$SAFE_PEERS" ]]; then
echo "The SAFE_PEERS variable has not been set"
exit 1
else
echo "SAFE_PEERS has been set to $SAFE_PEERS"
fi
- name: execute the spend simulation
run: cargo test --release -p sn_node --features="local-discovery" --test spend_simulation -- --nocapture --test-threads=1
run: cargo test --release -p sn_node --features="local-discovery" --test spend_simulation -- --nocapture
env:
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 25
Expand All @@ -417,7 +479,7 @@ jobs:
uses: maidsafe/sn-local-testnet-action@main
with:
action: stop
log_file_prefix: safe_test_logs_spend
log_file_prefix: safe_test_logs_spend_simulation
platform: ${{ matrix.os }}

token_distribution_test:
Expand All @@ -426,7 +488,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -794,6 +856,7 @@ jobs:
- name: Create and fund a wallet first time
run: |
~/safe --log-output-dest=data-dir wallet create --no-password
~/faucet --log-output-dest=data-dir send 100000000 $(~/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 1>first.txt
echo "----------"
cat first.txt
Expand All @@ -808,6 +871,7 @@ jobs:
rm -rf /home/runner/.local/share/safe/test_faucet
rm -rf /home/runner/.local/share/safe/test_genesis
rm -rf /home/runner/.local/share/safe/client
~/safe --log-output-dest=data-dir wallet create --no-password
~/faucet --log-output-dest=data-dir send 100000000 $(~/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 1>second.txt
echo "----------"
cat second.txt
Expand All @@ -828,6 +892,7 @@ jobs:
rm -rf /home/runner/.local/share/safe/test_faucet
rm -rf /home/runner/.local/share/safe/test_genesis
rm -rf /home/runner/.local/share/safe/client
~/safe --log-output-dest=data-dir wallet create --no-password
if GENESIS_PK=a9925296499299fdbf4412509d342a92e015f5b996e9acd1d2ab7f2326e3ad05934326efdc345345a95e973ac1bb6637 GENESIS_SK=40f6bbc870355c68138ac70b450b6425af02b49874df3f141b7018378ceaac66 nohup ~/faucet --log-output-dest=data-dir send 100000000 $(~/safe --log-output-dest=data-dir wallet address | tail -n 1); then
echo "Faucet with different genesis key not rejected!"
exit 1
Expand Down Expand Up @@ -966,6 +1031,7 @@ jobs:
- name: Create and fund a wallet to pay for files storage
run: |
~/safe --log-output-dest=data-dir wallet create --no-password
~/faucet --log-output-dest=data-dir send 100000000 $(~/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 > transfer_hex
~/safe --log-output-dest=data-dir wallet receive --file transfer_hex
env:
Expand Down Expand Up @@ -1098,6 +1164,7 @@ jobs:
- name: Create and fund a wallet to pay for files storage
run: |
./target/release/safe --log-output-dest=data-dir wallet create --no-password
./target/release/faucet --log-output-dest=data-dir send 100000000 $(./target/release/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 > transfer_hex
./target/release/safe --log-output-dest=data-dir wallet receive --file transfer_hex
env:
Expand Down Expand Up @@ -1182,6 +1249,7 @@ jobs:
ls -l $SAFE_DATA_PATH
mv $SAFE_DATA_PATH/client_first/logs $CLIENT_DATA_PATH/logs
ls -l $CLIENT_DATA_PATH
./target/release/safe --log-output-dest=data-dir wallet create --no-password
./target/release/faucet --log-output-dest=data-dir send 100000000 $(./target/release/safe --log-output-dest=data-dir wallet address | tail -n 1) | tail -n 1 > transfer_hex
./target/release/safe --log-output-dest=data-dir wallet receive --file transfer_hex
env:
Expand Down
Loading

0 comments on commit 6fb9e27

Please sign in to comment.