Skip to content

feat: integrate Nix into CI #242

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

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
63 changes: 0 additions & 63 deletions .github/actions/run-local-ic-example/action.yml

This file was deleted.

56 changes: 23 additions & 33 deletions .github/actions/run-local-ic-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,47 @@ inputs:
required: true
test-name:
description: "Name of the test to run"
required: true
example-name:
description: "Name of example to run"

runs:
using: "composite"
steps:
- name: Cache Build artefacts
uses: Swatinem/rust-cache@v2.7.5
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v6
with:
cache-on-failure: true
shared-key: ${{ github.event.pull_request.number || github.ref }}
# restore and save a cache using this key
primary-key: solidity-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'flake.nix', 'flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-

- name: Get cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: nicknovitski/nix-develop@v1

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: optimized-contracts
path: ./artifacts
- name: Pull WASM and Forge artifacts
run: |
nix build -vL .#valence-cosmwasm-contracts --out-link artifacts
nix build -vL .#valence-solidity-contracts --out-link solidity/out

- name: Download Forge artifacts
uses: actions/download-artifact@v4
with:
name: forge-artifacts
path: ./solidity/out/

- name: List downloaded files
shell: bash
- name: List artifacts
run: ls -l ./artifacts

- name: Download local-ic artifact
uses: actions/download-artifact@v4
with:
name: local-ic
path: /tmp

- name: Make local-ic executable
shell: bash
run: chmod +x /tmp/local-ic

- name: Start local-ic and wait for it to be ready
shell: bash
run: ./scripts/start-local-ic.sh ${{ inputs.chain-config }}

- name: Run local-ic example
if: ${{ inputs.example-name != '' }}
shell: bash
env:
RUST_LOG: debug
run: nix shell .#valence-program-examples --command ${{ inputs.test-name }}

- name: Run local-ic test
if: ${{ inputs.test-name != '' }}
shell: bash
env:
RUST_LOG: debug
run: cargo run --package valence-e2e --example ${{ inputs.test-name }}
run: nix shell .#valence-e2e --command ${{ inputs.example-name }}

- name: Cleanup
shell: bash
Expand Down
Loading