Skip to content

Commit ff9905a

Browse files
authored
chore(ci): improve testing coverage (#45)
1 parent 87c9acd commit ff9905a

File tree

1 file changed

+46
-29
lines changed

1 file changed

+46
-29
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,45 @@ permissions:
1313
env:
1414
REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
1515
REF: ${{ github.head_ref || github.ref_name }}
16+
MINIMUM_NOIR_VERSION: v0.16.0
1617

1718
jobs:
19+
noir-version-list:
20+
name: Query supported Noir versions
21+
runs-on: ubuntu-latest
22+
outputs:
23+
noir_versions: ${{ steps.get_versions.outputs.versions }}
24+
25+
steps:
26+
- name: Checkout sources
27+
id: get_versions
28+
run: |
29+
# gh returns the Noir releases in reverse chronological order so we keep all releases published after the minimum supported version.
30+
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')
31+
echo "versions=$VERSIONS"
32+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
36+
1837
install:
1938
name: Noir ${{matrix.toolchain}} (CLI) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
39+
needs: [noir-version-list]
2040
runs-on: ${{matrix.os}}-latest
2141
strategy:
2242
fail-fast: false
2343
matrix:
2444
os: [ubuntu, macos]
25-
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
45+
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
46+
include:
47+
- os: ubuntu
48+
toolchain: nightly
49+
- os: ubuntu
50+
toolchain: stable
51+
- os: macos
52+
toolchain: nightly
53+
- os: macos
54+
toolchain: stable
2655
timeout-minutes: 45
2756
steps:
2857
- name: Parse toolchain
@@ -53,14 +82,15 @@ jobs:
5382

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

83-
- name: Install Barretenberg dependencies
84-
if: matrix.os == 'ubuntu'
85-
run: sudo apt update && sudo apt install clang lld cmake libomp-dev
86-
87-
- name: Install Barretenberg dependencies
88-
if: matrix.os == 'macos'
89-
run: brew install cmake llvm libomp
90-
91113
- name: Install nargo from source with noirup
92114
run: noirup $toolchain
93115
env:
94-
toolchain: -b tags/v${{matrix.version}}
116+
toolchain: -b tags/${{matrix.version}}
95117
- name: Check nargo installation
96118
run: nargo --version
97119

98120
install-action:
99121
name: Noir ${{matrix.toolchain}} (GH action) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
122+
needs: [noir-version-list]
100123
runs-on: ${{matrix.os}}-latest
101124
strategy:
102125
fail-fast: false
103126
matrix:
104127
os: [ubuntu, macos]
105-
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
128+
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
129+
include:
130+
- os: ubuntu
131+
toolchain: nightly
132+
- os: ubuntu
133+
toolchain: stable
134+
- os: macos
135+
toolchain: nightly
136+
- os: macos
137+
toolchain: stable
106138
timeout-minutes: 45
107139
steps:
108140
- uses: actions/checkout@v3
@@ -115,22 +147,7 @@ jobs:
115147
- run: nargo new project
116148
- run: nargo check
117149
working-directory: ./project
118-
- run: |
119-
# Extract the minor version number from the version output
120-
version=$(nargo --version)
121-
version="${version#* }"
122-
version="${version%% (*}"
123-
minor=$(echo $version | cut -d '.' -f 2)
124-
125-
# The version in which the compile syntax changed
126-
if [ "$minor" -lt 10 ]; then
127-
nargo compile test-circuit
128-
else
129-
nargo compile
130-
fi
131-
name: nargo compile
150+
- run: nargo compile
132151
working-directory: ./project
133-
shell: bash
134152
- run: nargo test
135-
if: matrix.toolchain != '0.1.0'
136153
working-directory: ./project

0 commit comments

Comments
 (0)