Skip to content

Commit

Permalink
feat: add initial version of github action (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Mar 21, 2023
1 parent a3ffdc0 commit d60cb9c
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
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

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
47 changes: 47 additions & 0 deletions action.yml
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}}

0 comments on commit d60cb9c

Please sign in to comment.