Skip to content
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

chore(ci): improve testing coverage #45

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
75 changes: 46 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,45 @@ permissions:
env:
REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
REF: ${{ github.head_ref || github.ref_name }}
MINIMUM_NOIR_VERSION: v0.16.0

jobs:
noir-version-list:
name: Query supported Noir versions
runs-on: ubuntu-latest
outputs:
noir_versions: ${{ steps.get_versions.outputs.versions }}

steps:
- name: Checkout sources
id: get_versions
run: |
# gh returns the Noir releases in reverse chronological order so we keep all releases published after the minimum supported version.
VERSIONS=$(gh release list -R noir-lang/noir --exclude-pre-releases --json tagName -q 'map(.tagName) | index(env.MINIMUM_NOIR_VERSION) as $index | if $index then .[0:$index+1] else [env.MINIMUM_NOIR_VERSION] end')
echo "versions=$VERSIONS"
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}


install:
name: Noir ${{matrix.toolchain}} (CLI) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
needs: [noir-version-list]
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
include:
- os: ubuntu
toolchain: nightly
- os: ubuntu
toolchain: stable
- os: macos
toolchain: nightly
- os: macos
toolchain: stable
timeout-minutes: 45
steps:
- name: Parse toolchain
Expand Down Expand Up @@ -53,14 +82,15 @@ jobs:

install-source:
name: Noir ${{matrix.version}} (from source) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
needs: [noir-version-list]
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
# Installing from source can technically target any commit.
# However, we only guarantee that noirup will build release commits.
version: [0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
os: [ubuntu, macos]
version: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
timeout-minutes: 45
steps:
- name: Install noirup
Expand All @@ -80,29 +110,31 @@ jobs:
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ matrix.version }}

- name: Install Barretenberg dependencies
if: matrix.os == 'ubuntu'
run: sudo apt update && sudo apt install clang lld cmake libomp-dev

- name: Install Barretenberg dependencies
if: matrix.os == 'macos'
run: brew install cmake llvm libomp

- name: Install nargo from source with noirup
run: noirup $toolchain
env:
toolchain: -b tags/v${{matrix.version}}
toolchain: -b tags/${{matrix.version}}
- name: Check nargo installation
run: nargo --version

install-action:
name: Noir ${{matrix.toolchain}} (GH action) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
needs: [noir-version-list]
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
include:
- os: ubuntu
toolchain: nightly
- os: ubuntu
toolchain: stable
- os: macos
toolchain: nightly
- os: macos
toolchain: stable
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
Expand All @@ -115,22 +147,7 @@ jobs:
- run: nargo new project
- run: nargo check
working-directory: ./project
- run: |
# Extract the minor version number from the version output
version=$(nargo --version)
version="${version#* }"
version="${version%% (*}"
minor=$(echo $version | cut -d '.' -f 2)

# The version in which the compile syntax changed
if [ "$minor" -lt 10 ]; then
nargo compile test-circuit
else
nargo compile
fi
name: nargo compile
- run: nargo compile
working-directory: ./project
shell: bash
- run: nargo test
if: matrix.toolchain != '0.1.0'
working-directory: ./project