diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 44bfb4b..604aa8d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,36 +7,79 @@ on: jobs: build-wasm: - name: Build wasm + name: Build DNA runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - name: install Rust stable - uses: actions-rs/toolchain@v1 + - name: Install nix + uses: cachix/install-nix-action@v18 with: - override: true - toolchain: 1.75.0 - target: wasm32-unknown-unknown - - name: Setup dependency caching - uses: Swatinem/rust-cache@v2.2.1 - - name: Run build - uses: actions-rs/cargo@v1 + install_url: https://releases.nixos.org/nix/nix-2.13.3/install + extra_nix_config: | + experimental-features = flakes nix-command + - uses: cachix/cachix-action@v10 with: - command: build - args: --release --target wasm32-unknown-unknown --package '*_integrity' --package '*_coordinator' - - name: Move wasm files - run: scripts/mv_zome_wasm.sh - # We rename the directory such that none of it files are covered by the - # .gitignore - which the upload-artifact action skips - - name: Rename artifact - run: mv workdir happ_workdir + name: holochain-ci + - name: Set up Rust cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: game-identity-dna-${{ hashFiles('**/Cargo.lock') }} + - name: Build DNA + run: | + nix develop --command \ + npm run build:dna - uses: actions/upload-artifact@v4 if: always() with: name: happ_workdir - path: happ_workdir + path: workdir overwrite: true + dna-tests: + name: DNA Tests + runs-on: ubuntu-20.04 + needs: + - build-wasm + steps: + - uses: actions/checkout@v3 + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + - name: Install nix + uses: cachix/install-nix-action@v18 + with: + install_url: https://releases.nixos.org/nix/nix-2.13.3/install + extra_nix_config: | + experimental-features = flakes nix-command + - uses: cachix/cachix-action@v10 + with: + name: holochain-ci + - name: Set up Rust cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: game-identity-dna-tests-${{ hashFiles('**/Cargo.lock') }} + - run: rm -rf workdir + - name: Download DNA + uses: actions/download-artifact@v4 + with: + name: happ_workdir + path: workdir + - name: Build and run tests + run: | + nix develop --command \ + cargo nextest run -j 1 + e2e: name: Build and run end-to-end tests needs: build-wasm diff --git a/docker/prepare_sandbox.sh b/docker/prepare_sandbox.sh index ce54eca..321b1f4 100644 --- a/docker/prepare_sandbox.sh +++ b/docker/prepare_sandbox.sh @@ -46,7 +46,7 @@ yq -i ".roles[0].dna.modifiers.network_seed = \"$HOLOCHAIN_NETWORK_SEED\"" $HAPP yq -i ".roles[0].dna.modifiers.properties.authority_agent = \"$HOLOCHAIN_AGENT_PUBKEY\"" $HAPP_YAML_PATH echo "Packing happ" -hc app pack $HAPP_WORKDIR --recursive +hc app pack $HAPP_WORKDIR echo "Installing happ" echo $HOLOCHAIN_LAIR_PASSWORD | hc sandbox --piped \ diff --git a/package.json b/package.json index 062c273..35ad5f6 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,9 @@ ] }, "scripts": { - "build:zomes": "scripts/build_zomes.sh && scripts/mv_zome_wasm.sh", - "build:happ": "npm run build:zomes && hc app pack workdir --recursive", - "test:happ": "npm run build:happ && cargo nextest run -j 1", + "build:zomes": "scripts/build_zomes.sh", + "build:dna": "npm run build:zomes && hc dna pack workdir", + "test:dna": "npm run build:dna && cargo nextest run -j 1", "build:client": "npm run build -w @holochain-game-identity/client", "build:docker": "npm run build:zomes && scripts/build_docker_images.sh", "test:e2e": "npm run build:zomes && npm run build:docker && npm run build:client && npm run e2e -w @holochain-game-identity/e2e" diff --git a/scripts/mv_zome_wasm.sh b/scripts/mv_zome_wasm.sh deleted file mode 100755 index 6624054..0000000 --- a/scripts/mv_zome_wasm.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -cd -- "$( dirname -- "$0" )" - - -RELEASE_DIR=../target/wasm32-unknown-unknown/release -WORK_DIR=../workdir - -mv $RELEASE_DIR/username_registry_integrity.wasm $WORK_DIR/ -mv $RELEASE_DIR/username_registry_coordinator.wasm $WORK_DIR/ -mv $RELEASE_DIR/signer_coordinator.wasm $WORK_DIR/ -mv $RELEASE_DIR/ping_coordinator.wasm $WORK_DIR/ diff --git a/workdir/dna.yaml b/workdir/dna.yaml index 14cc984..1762324 100644 --- a/workdir/dna.yaml +++ b/workdir/dna.yaml @@ -9,18 +9,18 @@ integrity: zomes: - name: username_registry_integrity hash: ~ - bundled: "./username_registry_integrity.wasm" + bundled: "../target/wasm32-unknown-unknown/release/username_registry_integrity.wasm" dependencies: ~ coordinator: zomes: - name: username_registry hash: ~ - bundled: "./username_registry_coordinator.wasm" + bundled: "../target/wasm32-unknown-unknown/release/username_registry_coordinator.wasm" dependencies: - name: username_registry_integrity - name: signer hash: ~ - bundled: "./signer_coordinator.wasm" + bundled: "../target/wasm32-unknown-unknown/release/signer_coordinator.wasm" - name: ping hash: ~ - bundled: "./ping_coordinator.wasm" + bundled: "../target/wasm32-unknown-unknown/release/ping_coordinator.wasm"