Skip to content

Run scenarios with CHC enabled #296

Run scenarios with CHC enabled

Run scenarios with CHC enabled #296

Workflow file for this run

name: "test"
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
merge_group:
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Maximize build space
if: runner.os == 'Linux'
uses: AdityaGarg8/remove-unwanted-software@v2
with:
remove-dotnet: 'true'
remove-android: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Install nix
uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: holochain-wind-tunnel
extraPullNames: holochain-ci
authToken: ${{ secrets.CACHIX_HOLOCHAIN_WIND_TUNNEL }}
- uses: Swatinem/rust-cache@v2
- name: Check scripts
run: |
nix develop .#ci -c bash -c "shellcheck scripts/*.sh"
- name: Check Nix formatting
run: |
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_nix_fmt"
- name: Lint Nix
run: |
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_nix_static"
- name: Check Rust formatting
run: |
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_rust_fmt"
- name: Build and unit tests
run: |
nix build .#workspace
- name: Lint Rust
run: |
# Currently the only check is clippy, could bundle the other checks into the flake and remove the steps above?
nix flake check --all-systems
- name: Smoke test - zome_call_single_value
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# TODO using `localhost` is resolving to an IPv6 address, but why is that giving a connection refused?
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#zome_call_single_value -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - single_write_many_read
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#single_write_many_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - dht_sync_lag
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#dht_sync_lag -- --connection-string ws://localhost:8888 --agents 2 --behaviour write:1 --behaviour record_lag:1 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - app_install
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#app_install -- --connection-string ws://localhost:8888 --agents 2 --behaviour minimal:1 --behaviour large:1 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore
- name: Smoke test - first_call
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#first_call -- --connection-string ws://localhost:8888 --agents 1 --behaviour local:1 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore
- name: Smoke test - write_read
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - write_query
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_query -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - local_signals
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#local_signals -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - write_validated
run: |
# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "./scripts/run.sh"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_validated -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill hc && pkill holochain && pkill lair-keystore && pkill hc-chc-service
- name: Smoke test - trycp_write_validated
run: |
set -x
# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"
# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#trycp_write_validated -- --targets targets-ci.yaml --instances-per-target 2 --duration 10 --no-progress
# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local
- name: Smoke test - remote_call_rate
run: |
set -x
# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"
# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#remote_call_rate -- --targets targets-ci.yaml --instances-per-target 2 --duration 10 --no-progress
# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local
- name: Smoke test - two_party_countersigning
run: |
# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"
# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#two_party_countersigning -- --targets targets-ci.yaml --behaviour initiate:1 --behaviour participate:1 --instances-per-target 2 --duration 10 --no-progress
# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local
- name: Smoke test - validation_receipts
run: |
set -x
# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"
# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" MIN_PEERS=2 nix run .#validation_receipts -- --targets targets-ci.yaml --instances-per-target 2 --duration 10 --no-progress
# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local
- name: Build scenario bundles
if: runner.os == 'Linux'
run: |
set -euxo pipefail
scenario_names() {
find scenarios/ -mindepth 1 -maxdepth 1 -type d -printf "%f\n"
}
# Disable sandbox because hApp builds aren't done by Nix and need network access.
scenario_names | xargs -I % nix bundle --option sandbox false .#packages.x86_64-linux.%
mkdir -p dist
scenario_names | xargs -I % cp % dist/
- name: Archive scenario bundles
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: scenario-bundles
if-no-files-found: error
path: dist/*