diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6058050 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 + \ No newline at end of file diff --git a/README.md b/README.md index ce8c5e1..31929fe 100644 --- a/README.md +++ b/README.md @@ -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. + +
+ +## 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/noirup@v0.1.0 + with: + version: 0.3.2 + - run: nargo test +``` + +
+ +## Inputs + +All inputs are optional. + + + + + + + + + + +
NameDescription
version + Noirup toolchain version e.g. 0.3.2. Defaults to the latest stable release. +
+ +
diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..dc9b3c3 --- /dev/null +++ b/action.yml @@ -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}} + \ No newline at end of file