Skip to content

Commit 043b8e9

Browse files
kashbrtiKhashayar Barooti
andauthored
chore: added automatic testing with different versions (#13)
Co-authored-by: Khashayar Barooti <[email protected]>
1 parent 7669148 commit 043b8e9

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,42 @@ name: Noir tests
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches:
6+
- master
77
pull_request:
88

99
env:
1010
CARGO_TERM_COLOR: always
11+
MINIMUM_NOIR_VERSION: v0.36.0
1112

1213
jobs:
14+
noir-version-list:
15+
name: Query supported Noir versions
16+
runs-on: ubuntu-latest
17+
outputs:
18+
noir_versions: ${{ steps.get_versions.outputs.versions }}
19+
20+
steps:
21+
- name: Checkout sources
22+
id: get_versions
23+
run: |
24+
# gh returns the Noir releases in reverse chronological order so we keep all releases published after the minimum supported version.
25+
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')
26+
echo "versions=$VERSIONS"
27+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
1331
test:
32+
needs: [noir-version-list]
1433
name: Test on Nargo ${{matrix.toolchain}}
1534
runs-on: ubuntu-latest
1635
strategy:
1736
fail-fast: false
1837
matrix:
19-
toolchain: [nightly, 0.36.0]
38+
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
39+
include:
40+
- toolchain: nightly
2041
steps:
2142
- name: Checkout sources
2243
uses: actions/checkout@v4
@@ -38,7 +59,7 @@ jobs:
3859
- name: Install Nargo
3960
uses: noir-lang/[email protected]
4061
with:
41-
toolchain: 0.36.0
62+
toolchain: ${{ env.MINIMUM_NOIR_VERSION }}
4263

4364
- name: Run formatter
4465
run: nargo fmt --check
@@ -50,7 +71,7 @@ jobs:
5071
runs-on: ubuntu-latest
5172
# We want this job to always run (even if the dependant jobs fail) as we want this job to fail rather than skipping.
5273
if: ${{ always() }}
53-
needs:
74+
needs:
5475
- test
5576
- format
5677

@@ -64,4 +85,4 @@ jobs:
6485
fi
6586
env:
6687
# We treat any cancelled, skipped or failing jobs as a failure for the workflow as a whole.
67-
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
88+
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}

0 commit comments

Comments
 (0)