Skip to content

Commit

Permalink
Add job to test Nix build (#146)
Browse files Browse the repository at this point in the history
* Add package smoke test

* Add `nix` job

* Build Foundry with Kontrol

* Run job on `MacM1` too

* Set Version: 0.1.43

---------

Co-authored-by: devops <devops@runtimeverification.com>
  • Loading branch information
tothtamas28 and devops authored Oct 30, 2023
1 parent 3622f45 commit b50f484
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,48 @@ jobs:
if: always()
run: |
docker stop --time=0 ${CONTAINER_NAME}
nix:
needs: code-quality-checks
name: 'Nix Tests'
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest, macos-13, MacM1] # MacM1 is self-hosted
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Install Nix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/install-nix-action@v22
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
- name: 'Install Cachix'
if: ${{ matrix.runner != 'MacM1' }}
uses: cachix/cachix-action@v12
with:
name: k-framework
authToken: ${{ secrets.CACHIX_PUBLIC_TOKEN }}

- name: 'Build Kontrol'
env:
NIX_PATH: 'nixpkgs=http://nixos.org/channels/nixos-22.05/nixexprs.tar.xz'
GC_DONT_GC: '1'
run: |
nix --version
JQ=$(nix-build '<nixpkgs>' -A jq --no-link)/bin/jq
KONTROL_BIN=$(nix build .#kontrol.solc_0_8_13 --print-build-logs --json | $JQ -r '.[].outputs | to_entries[].value')/bin
echo $KONTROL_BIN >> $GITHUB_PATH
- name: 'Run smoke test'
run: cd package && ./test-package.sh
11 changes: 11 additions & 0 deletions package/test-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -euxo pipefail

which kontrol
kontrol --help
kontrol version

cd test-project
kontrol build
kontrol prove --match-test 'AssertTest.test_assert_true()'
4 changes: 4 additions & 0 deletions package/test-project/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[profile.default]
src = 'src'
out = 'out'
extra_output = ['storageLayout', 'abi', 'evm.methodIdentifiers', 'evm.deployedBytecode.object']
8 changes: 8 additions & 0 deletions package/test-project/test/Simple.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.13;

contract AssertTest {
function test_assert_true() public pure {
assert(true);
}
}
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.42
0.1.43
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kontrol"
version = "0.1.42"
version = "0.1.43"
description = "Foundry integration for KEVM"
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '0.1.42'
VERSION: Final = '0.1.43'

0 comments on commit b50f484

Please sign in to comment.