From 0de7fe54bb8632dfb29e95a5e0d9bed82c86126e Mon Sep 17 00:00:00 2001 From: nazar <121292278+pryimak2@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:43:56 +0200 Subject: [PATCH 1/3] Create publish-nargo-feature.yml for feature noirc_frontend/aztec --- .github/workflows/publish-nargo-feature.yml | 110 ++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/publish-nargo-feature.yml diff --git a/.github/workflows/publish-nargo-feature.yml b/.github/workflows/publish-nargo-feature.yml new file mode 100644 index 00000000000..32987f4e072 --- /dev/null +++ b/.github/workflows/publish-nargo-feature.yml @@ -0,0 +1,110 @@ +name: Publish Nargo + +on: + workflow_dispatch: + # Allow pushing a manual nightly release + inputs: + tag: + description: The tag to build Nargo from (leave empty to build a nightly release from master) + required: false + features: + description: Extra feature flags to release with + required: false + publish: + description: Whether to publish the build artifacts + type: boolean + default: false + merge_group: + pull_request: + +permissions: + # Necessary to upload new release artifacts + contents: write + +jobs: + build-linux: + runs-on: ubuntu-22.04 + env: + CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml + NIGHTLY_RELEASE: ${{ inputs.tag == '' }} + strategy: + fail-fast: false + matrix: + target: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || env.GITHUB_REF }} + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.66.0 + with: + targets: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Install Cross + uses: taiki-e/install-action@v2 + with: + tool: cross@0.2.5 + + - name: Build Nargo + run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }} noirc_frontend/aztec" + + - name: Package artifacts + run: | + mkdir dist + cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo-${{ matrix.target }} + path: ./dist/* + retention-days: 3 + + - name: Install Yarn dependencies + if: startsWith(matrix.target, 'x86_64-unknown-linux') + uses: ./.github/actions/setup + + - name: Test built artifact + if: startsWith(matrix.target, 'x86_64-unknown-linux') + run: | + cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ + yarn workspace release-tests test + + - name: Upload binaries to release tag + uses: svenstaro/upload-release-action@v2 + if: ${{ inputs.publish }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + overwrite: true + tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch) + + - name: Get formatted date + id: date + if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} + run: echo "date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Upload binaries to release with date tag + uses: svenstaro/upload-release-action@v2 + if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + prerelease: true + make_latest: false + overwrite: true + tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }} From 52e78d1d5d44ac54dce4d2deecf7de9c42137509 Mon Sep 17 00:00:00 2001 From: nazar <121292278+pryimak2@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:44:17 +0200 Subject: [PATCH 2/3] Update publish-nargo-feature.yml --- .github/workflows/publish-nargo-feature.yml | 52 --------------------- 1 file changed, 52 deletions(-) diff --git a/.github/workflows/publish-nargo-feature.yml b/.github/workflows/publish-nargo-feature.yml index 32987f4e072..52e8d1cbe6e 100644 --- a/.github/workflows/publish-nargo-feature.yml +++ b/.github/workflows/publish-nargo-feature.yml @@ -56,55 +56,3 @@ jobs: - name: Build Nargo run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }} noirc_frontend/aztec" - - - name: Package artifacts - run: | - mkdir dist - cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo - 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: nargo-${{ matrix.target }} - path: ./dist/* - retention-days: 3 - - - name: Install Yarn dependencies - if: startsWith(matrix.target, 'x86_64-unknown-linux') - uses: ./.github/actions/setup - - - name: Test built artifact - if: startsWith(matrix.target, 'x86_64-unknown-linux') - run: | - cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ - yarn workspace release-tests test - - - name: Upload binaries to release tag - uses: svenstaro/upload-release-action@v2 - if: ${{ inputs.publish }} - with: - repo_name: noir-lang/noir - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz - overwrite: true - tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch) - - - name: Get formatted date - id: date - if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} - run: echo "date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT - - - name: Upload binaries to release with date tag - uses: svenstaro/upload-release-action@v2 - if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} - with: - repo_name: noir-lang/noir - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nargo-${{ matrix.target }}.tar.gz - asset_name: nargo-${{ matrix.target }}.tar.gz - prerelease: true - make_latest: false - overwrite: true - tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }} From 4198f2e45227c6f6382cf01f57bb7d0388231bc5 Mon Sep 17 00:00:00 2001 From: nazar <121292278+pryimak2@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:53:21 +0200 Subject: [PATCH 3/3] Not workflow dispatches --- .github/workflows/publish-nargo-feature.yml | 24 ++++++--------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish-nargo-feature.yml b/.github/workflows/publish-nargo-feature.yml index 52e8d1cbe6e..c8ab931f491 100644 --- a/.github/workflows/publish-nargo-feature.yml +++ b/.github/workflows/publish-nargo-feature.yml @@ -1,21 +1,9 @@ -name: Publish Nargo +name: Publish Nargo Feature on: - workflow_dispatch: - # Allow pushing a manual nightly release - inputs: - tag: - description: The tag to build Nargo from (leave empty to build a nightly release from master) - required: false - features: - description: Extra feature flags to release with - required: false - publish: - description: Whether to publish the build artifacts - type: boolean - default: false - merge_group: pull_request: + branches: + - '*' permissions: # Necessary to upload new release artifacts @@ -26,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 env: CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml - NIGHTLY_RELEASE: ${{ inputs.tag == '' }} + strategy: fail-fast: false matrix: @@ -36,7 +24,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ inputs.tag || env.GITHUB_REF }} + ref: ${{ github.event.pull_request.head.sha }} - name: Setup toolchain uses: dtolnay/rust-toolchain@1.66.0 @@ -55,4 +43,4 @@ jobs: tool: cross@0.2.5 - name: Build Nargo - run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }} noirc_frontend/aztec" + run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ github.event.pull_request.body }} noirc_frontend/aztec"