Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindTunnel Scenario Packaging #7

Merged
merged 41 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
570e7c8
Update flake.lock
ThetaSinner Mar 11, 2024
43dd7d6
Checkpoint: can run a Nix built app
ThetaSinner Mar 11, 2024
8493aec
Fix warnings and add comments
ThetaSinner Mar 11, 2024
e74edef
Bundle first scenario
ThetaSinner Mar 11, 2024
ba7de1a
Discover happs when running from a bundle
ThetaSinner Mar 12, 2024
a5246a7
Checkpoint nix integration with happ build process and bundling
ThetaSinner Mar 12, 2024
e85ed47
Code tidy
ThetaSinner Mar 12, 2024
62e7e83
Automatically discover scenarios and map as apps
ThetaSinner Mar 12, 2024
28112aa
Format Nix and check in CI
ThetaSinner Mar 13, 2024
63934d1
Lint Nix and check in CI
ThetaSinner Mar 13, 2024
81332c6
Improve source filtering
ThetaSinner Mar 13, 2024
64a473b
Remove unused binding
ThetaSinner Mar 13, 2024
5db5b2a
Add caching in CI
ThetaSinner Mar 13, 2024
863cf35
Correct statix command
ThetaSinner Mar 13, 2024
5d41afe
Fix Nix lint
ThetaSinner Mar 13, 2024
f37268b
Extract CI checks
ThetaSinner Mar 13, 2024
292eb4f
Fix shell check
ThetaSinner Mar 13, 2024
75bbb6a
Flake update
ThetaSinner Mar 13, 2024
2152d6f
Clean up naming and move apps to scenarios
ThetaSinner Mar 13, 2024
02146af
Build and archive scenario bundles
ThetaSinner Mar 13, 2024
0293d8b
Disable sandbox
ThetaSinner Mar 13, 2024
3c65c2d
Format
ThetaSinner Mar 13, 2024
cdc2783
Put scenario bundles in the right place
ThetaSinner Mar 13, 2024
59b3a6e
Move happ build to Nix
ThetaSinner Mar 14, 2024
77fb5d3
Re-enable smoke test
ThetaSinner Mar 14, 2024
e74c5bb
Reduce the out size of the happs derivation
ThetaSinner Mar 14, 2024
f00620a
Lint fixes
ThetaSinner Mar 14, 2024
9445e44
Tidy up
ThetaSinner Mar 14, 2024
204f6a8
Speed up CI by preventing hApp builds
ThetaSinner Mar 14, 2024
9d442c6
More nix, less cargo
ThetaSinner Mar 14, 2024
eb2ac85
Fix bad command in CI
ThetaSinner Mar 14, 2024
ab26a55
Improve shutdown output
ThetaSinner Mar 14, 2024
ebe78d9
Cancel in progress
ThetaSinner Mar 14, 2024
fc8190e
Lint Rust with Nix to avoid building the workspace twice
ThetaSinner Mar 14, 2024
21b40d8
Share workspace deps to reduce build overhead
ThetaSinner Mar 14, 2024
b516712
Swap steps, makes more sense
ThetaSinner Mar 14, 2024
acab338
Try a store gc
ThetaSinner Mar 14, 2024
52f20dd
Make more space
ThetaSinner Mar 14, 2024
9925720
ghc no longer installed
ThetaSinner Mar 14, 2024
1f99c40
boost no longer installed
ThetaSinner Mar 14, 2024
eca4f7f
Try action that is tested rather than removing directly
ThetaSinner Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 68 additions & 30 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
name: "test"

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Maximize build space
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@v25
with:
Expand All @@ -20,57 +33,82 @@ jobs:

- uses: cachix/cachix-action@v14
with:
name: holochain-ci
name: holochain-wind-tunnel
extraPullNames: holochain-ci
authToken: ${{ secrets.CACHIX_HOLOCHAIN_WIND_TUNNEL }}

- name: Lint
- name: Check scripts
run: |
nix develop --command bash -c "cargo clippy --workspace --all-targets --all-features -- -D warnings"
nix develop --command bash -c "shellcheck scripts/*.sh"

- name: Check formatting
- name: Check Nix formatting
run: |
nix develop --command bash -c "cargo fmt --all -- --check"
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_fmt"

- name: Unit tests
- name: Lint Nix
run: |
nix develop --command bash -c "cargo test"
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_static"

- name: Check Rust formatting
run: |
nix develop .#ci --command 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

- name: Smoke test - zome_call_single_value
run: |
# Start a sandbox conductor and run it in the background
nix develop --command 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
nix develop --command bash -c "RUST_LOG=info cargo run --package zome_call_single_value -- --connection-string ws://localhost:8888 --duration 5 --no-progress --no-metrics"
RUST_LOG=info nix run .#zome_call_single_value -- --connection-string ws://localhost:8888 --duration 5 --no-progress --no-metrics

pkill hc
pkill holochain
pkill lair-keystore
pkill --echo hc && pkill --echo holochain && pkill --echo lair-keystore

- name: Smoke test - single_write_many_read
run: |
# Start a sandbox conductor and run it in the background
nix develop --command 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
nix develop --command bash -c "RUST_LOG=info cargo run --package single_write_many_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress --no-metrics"
RUST_LOG=info nix run .#single_write_many_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress --no-metrics

pkill hc
pkill holochain
pkill lair-keystore

# Failed on CI with ` error: linking with `cc` failed: exit status: 1`
# - name: Smoke test - dht_sync_lag
# run: |
# # Start a sandbox conductor and run it in the background
# nix develop --command 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
# nix develop --command bash -c "RUST_LOG=info cargo run --package dht_sync_lag -- --connection-string ws://localhost:8888 --agents 2 --behaviour write:1 --behaviour record_lag:1 --duration 5 --no-progress --no-metrics"
#
# pkill hc
# pkill holochain
# pkill lair-keystore
pkill --echo hc && pkill --echo holochain && pkill --echo lair-keystore

- name: Check scripts
- name: Smoke test - dht_sync_lag
run: |
nix develop --command bash -c "shellcheck scripts/*.sh"
# Start a sandbox conductor and run it in the background
nix develop --command 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 .#dht_sync_lag -- --connection-string ws://localhost:8888 --agents 2 --behaviour write:1 --behaviour record_lag:1 --duration 5 --no-progress --no-metrics

pkill --echo hc && pkill --echo holochain && pkill --echo lair-keystore

- name: Build scenario bundles
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
uses: actions/upload-artifact@v4
with:
name: scenario-bundles
if-no-files-found: error
path: dist/*
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
wasm-target/

# These are backup files generated by rustfmt
**/*.rs.bk
Expand All @@ -20,7 +17,9 @@ Cargo.lock
.hc_*

dnas/**/*.dna
dnas/**/*.yaml
happs/**/*.happ
happs/**/*.yaml

/influx/.influxdbv2
influx/influx.toml
Loading