diff --git a/.github/workflows/test-nix.yml b/.github/workflows/test-nix.yml new file mode 100644 index 0000000..0f25caa --- /dev/null +++ b/.github/workflows/test-nix.yml @@ -0,0 +1,41 @@ +name: "test-nix-infra" +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +jobs: + testbuild: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Extend space + uses: ./.github/actions/extend-space + + - name: Install nix + uses: cachix/install-nix-action@v18 + with: + install_url: https://releases.nixos.org/nix/nix-2.12.0/install + extra_nix_config: | + experimental-features = flakes nix-command + + - uses: cachix/cachix-action@v10 + with: + name: holochain-ci + + - name: Install coreutils for macOS + if: matrix.os == 'macos-latest' + run: brew install coreutils + + - name: Build zomes + run: | + cd ./nix/fixture + nix build -L .#my_zome.meta.debug + sha256sum result + nix build -L .#my_zome + sha256sum result + diff --git a/flake.nix b/flake.nix index 4f6e52e..3403601 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,7 @@ overlays = [ (import inputs.rust-overlay) ]; }; - rustToolchain = pkgs.rust-bin.stable."1.74.1".minimal.override { + rustToolchain = pkgs.rust-bin.nightly."2024-01-29".minimal.override { # Set the build targets supported by the toolchain, # wasm32-unknown-unknown is required for trunk. targets = [ "wasm32-unknown-unknown" ]; diff --git a/nix/fixture/Cargo.toml b/nix/fixture/Cargo.toml index 35ad88d..dd7a423 100644 --- a/nix/fixture/Cargo.toml +++ b/nix/fixture/Cargo.toml @@ -1,4 +1,4 @@ -# cargo-features = ["trim-paths"] +cargo-features = ["trim-paths"] [workspace] members = ["zome"] @@ -12,5 +12,5 @@ serde = "1" [profile.release] opt-level = "z" -# trim-paths = true -# remap-debuginfo = true +trim-paths = true +remap-debuginfo = true diff --git a/nix/fixture/flake.lock b/nix/fixture/flake.lock index 5e66b5f..122590a 100644 --- a/nix/fixture/flake.lock +++ b/nix/fixture/flake.lock @@ -540,7 +540,7 @@ }, "locked": { "lastModified": 0, - "narHash": "sha256-HkZkvxvNeC+n0Pzjgyb/Wn8hx3ed03iWRhoGunCQbd4=", + "narHash": "sha256-dwDb+8sDAzp+Q7ezlMfXpehwHW4Uy4jfg9N1w/Fv5So=", "path": "../..", "type": "path" }, diff --git a/nix/fixture/zome/src/lib.rs b/nix/fixture/zome/src/lib.rs index b9984e1..7908d72 100644 --- a/nix/fixture/zome/src/lib.rs +++ b/nix/fixture/zome/src/lib.rs @@ -1,5 +1,6 @@ use hdk::prelude::*; + #[hdk_extern] pub fn hello(_: ()) -> ExternResult { Ok(String::from("hello")) diff --git a/nix/zome.nix b/nix/zome.nix index 30ca4b7..4ffa6b0 100644 --- a/nix/zome.nix +++ b/nix/zome.nix @@ -9,7 +9,7 @@ }: let - cargoExtraArgs = "--workspace ${if excludedCrates != null then builtins.concatStringsSep " " (builtins.map (excludedCrate: ''--exclude ${excludedCrate}'') excludedCrates) else ''''}"; + cargoExtraArgs = "-Z avoid-dev-deps --workspace ${if excludedCrates != null then builtins.concatStringsSep " " (builtins.map (excludedCrate: ''--exclude ${excludedCrate}'') excludedCrates) else ''''}"; cargoToml = builtins.fromTOML (builtins.readFile crateCargoToml); crate = cargoToml.package.name; @@ -31,7 +31,7 @@ let cargoToml = crateCargoToml; cargoLock = workspacePath + /Cargo.lock; cargoArtifacts = wasmDeps; - cargoExtraArgs = "-p ${crate} --locked"; + cargoExtraArgs = "-p ${crate} --locked -v"; pname = crate; version = cargoToml.package.version; });