ghc: 9.6 -> 9.10 #773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Network fault tolerance" | |
on: | |
push: | |
branches: | |
- master | |
- release | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
network-test: | |
runs-on: ubuntu-latest | |
strategy: | |
# Hack: Minimise concurrency as this is blocking our GitHub runners. | |
# This can be removed when the matrix mode itself is removed and the | |
# network testing is done in pure Haskell. | |
max-parallel: 2 | |
matrix: | |
# Note: At present we can only run for 3 peers; to configure this for | |
# more we need to make the docker-compose spin-up dynamic across | |
# however many we would like to configure here. | |
# Currently this is just a label and does not have any functional impact. | |
peers: [3] | |
scaling_factor: [10, 50] | |
# Note: We only put here the configuration values we _expected to pass_. | |
netem_loss: [0, 1, 2, 3] | |
name: "Peers: ${{ matrix.peers }}, scaling: ${{ matrix.scaling_factor }}, loss: ${{ matrix.netem_loss }}" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: ❄ Prepare nix | |
uses: cachix/install-nix-action@V28 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
log-lines = 1000 | |
- name: ❄ Cachix cache of nix derivations | |
uses: cachix/cachix-action@v15 | |
with: | |
name: cardano-scaling | |
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' | |
- name: Set up and use the "ci" devShell | |
uses: nicknovitski/nix-develop@v1 | |
with: | |
arguments: ".#ci" | |
- name: Build docker images for netem specifically | |
run: | | |
nix build .#docker-hydra-node-for-netem | |
./result | docker load | |
- name: Setup containers for network testing | |
run: | | |
set -exo pipefail | |
cd demo | |
./prepare-devnet.sh | |
docker compose up -d cardano-node | |
sleep 5 | |
# :tear: socket permissions. | |
sudo chown runner:docker devnet/node.socket | |
HYDRA_SCRIPTS_TX_ID=$(nix run .#hydra-node -- publish-scripts \ | |
--testnet-magic 42 \ | |
--node-socket devnet/node.socket \ | |
--cardano-signing-key devnet/credentials/faucet.sk) | |
echo "HYDRA_SCRIPTS_TX_ID=$HYDRA_SCRIPTS_TX_ID" > .env | |
nix run .#cardano-cli -- query protocol-parameters \ | |
--testnet-magic 42 \ | |
--socket-path devnet/node.socket \ | |
--out-file /dev/stdout \ | |
| jq ".txFeeFixed = 0 | .txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0" \ | |
> devnet/protocol-parameters.json | |
# Specify two docker compose yamls; the second one overrides the | |
# images to use the netem ones specifically | |
docker compose -f docker-compose.yaml -f docker-compose-netem.yaml up -d hydra-node-{1,2,3} | |
sleep 3 | |
docker ps | |
- name: Build required nix and docker derivations | |
run: | | |
nix build .#legacyPackages.x86_64-linux.hydra-cluster.components.benchmarks.bench-e2e | |
nix build github:noonio/pumba/noon/add-flake | |
# Use tmate to get a shell onto the runner to do some temporary hacking | |
# | |
# <https://github.com/mxschmitt/action-tmate> | |
# | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
limit-access-to-actor: true | |
- name: Run pumba and the benchmarks | |
run: | | |
# Extract inputs with defaults for non-workflow_dispatch events | |
percent="${{ matrix.netem_loss }}" | |
scaling_factor="${{ matrix.scaling_factor }}" | |
target_peer="hydra-node-1" | |
other_peers="172.16.238.20 172.16.238.30" | |
.github/workflows/network/run_pumba.sh $target_peer $percent $other_peers | |
# Run benchmark on demo | |
mkdir benchmarks | |
touch benchmarks/test.log | |
nix run .#legacyPackages.x86_64-linux.hydra-cluster.components.benchmarks.bench-e2e -- \ | |
demo \ | |
--output-directory=benchmarks \ | |
--scaling-factor="$scaling_factor" \ | |
--timeout=1000s \ | |
--testnet-magic 42 \ | |
--node-socket=demo/devnet/node.socket \ | |
--hydra-client=localhost:4001 \ | |
--hydra-client=localhost:4002 \ | |
--hydra-client=localhost:4003 | |
- name: Acquire logs | |
if: always() | |
run: | | |
cd demo | |
docker compose logs > docker-logs | |
- name: 💾 Upload logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "artifacts-netem-loss=${{ matrix.netem_loss }},scaling_factor=${{ matrix.scaling_factor }},peers=${{ matrix.peers }}" | |
path: | | |
demo/docker-logs | |
benchmarks | |
demo/devnet/protocol-parameters.json | |
if-no-files-found: ignore |