Skip to content

Commit

Permalink
chore: build and test dna in ci (#5)
Browse files Browse the repository at this point in the history
* chore: build and test dna in ci

* fix: install open ssl before running hc

* chore: try with update

* fix: build with nix for working hc bin

* chore: CI prebuilds dna tests

* fix: CI

* fix(CI): free disk space for caching

* fix(CI): give up building tests in parallel
  • Loading branch information
8e8b2c authored Apr 16, 2024
1 parent 17239f8 commit 9e7c440
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 38 deletions.
81 changes: 62 additions & 19 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- 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
Expand Down
2 changes: 1 addition & 1 deletion docker/prepare_sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 0 additions & 11 deletions scripts/mv_zome_wasm.sh

This file was deleted.

8 changes: 4 additions & 4 deletions workdir/dna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 9e7c440

Please sign in to comment.