-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add initial version of github action (#11)
- Loading branch information
1 parent
a3ffdc0
commit d60cb9c
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
schedule: | ||
- cron: "40 2 * * *" # Run 40 mins after nightly noir release (which happens at 2 AM UTC) | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
install: | ||
name: Noir ${{matrix.toolchain}} on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} | ||
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] | ||
timeout-minutes: 45 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./ | ||
name: Run noir-lang/noirup | ||
id: version | ||
with: | ||
toolchain: ${{matrix.toolchain}} | ||
- run: nargo --version | ||
- run: nargo new project | ||
- run: nargo check | ||
working-directory: ./project | ||
- run: nargo compile test-circuit | ||
working-directory: ./project | ||
- run: nargo test | ||
if: matrix.toolchain != '0.1.0' | ||
working-directory: ./project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,52 @@ noirup --path ./git/noir | |
**Tip**: All flags have a single character shorthand equivalent! You can use `-v` instead of `--version`, etc. | ||
|
||
--- | ||
|
||
## Github Action | ||
|
||
This action is in early development and so will likely experience breaking changes. It's recommended to pin to a particular tagged version. | ||
|
||
--- | ||
|
||
Noirup is also available as a GitHub action to allow easy installation of the Noir toolchain using noirup. | ||
|
||
<br> | ||
|
||
## Example workflow | ||
|
||
```yaml | ||
name: test suite | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
name: nargo test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: noir-lang/[email protected] | ||
with: | ||
version: 0.3.2 | ||
- run: nargo test | ||
``` | ||
<br> | ||
## Inputs | ||
All inputs are optional. | ||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr> | ||
<td><code>version</code></td> | ||
<td> | ||
Noirup toolchain version e.g. <code>0.3.2</code>. Defaults to the latest stable release. | ||
</td> | ||
</tr> | ||
</table> | ||
<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Noir Toolchain Install | ||
description: Install the Noir toolchain | ||
branding: | ||
icon: activity | ||
color: gray-dark | ||
|
||
inputs: | ||
toolchain: | ||
description: Noir version to install. Defaults to the latest stable version. | ||
default: stable | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check for unsupported OS (Windows) | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: echo "::error::Noirup Github action does not currently support Windows" && exit 1 | ||
|
||
- name: Parse toolchain | ||
id: parse | ||
run: | | ||
: parse toolchain version | ||
if [[ $toolchain == "stable" ]]; then | ||
: By default, noirup installs the latest stable version | ||
elif [[ $toolchain == "nightly" ]]; then | ||
echo "toolchain="--nightly"" >> $GITHUB_OUTPUT | ||
else | ||
echo "toolchain="--version $toolchain"" >> $GITHUB_OUTPUT | ||
fi | ||
env: | ||
toolchain: ${{inputs.toolchain}} | ||
shell: bash | ||
|
||
- name: Create `.nargo/bin` directory | ||
shell: bash | ||
run: | | ||
mkdir -p $HOME/.nargo/bin | ||
chmod +x $HOME/.nargo/bin | ||
echo "${HOME}/.nargo/bin" >> $GITHUB_PATH | ||
- name: Run Noirup | ||
shell: bash | ||
run: | ||
${{ github.action_path }}/noirup ${{steps.parse.outputs.toolchain}} | ||
|