Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upload acir artifacts as a github artifact #3288

Merged
merged 11 commits into from
Oct 26, 2023
39 changes: 38 additions & 1 deletion .github/workflows/auto-pr-rebuild-script.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
name: Rebuild ACIR artifacts

on:
pull_request:
push:
branches:
- master

jobs:
check-artifacts-requested:
name: Check if artifacts should be published
runs-on: ubuntu-22.04
outputs:
publish: ${{ steps.check.outputs.publish }}

steps:
- name: Check if artifacts should be published
id: check
run: |
if [ ${{ github.ref_name }} == "master" ]; then
# Always publish on master
echo "publish=true" >> "$GITHUB_OUTPUT"
else
# Only publish on PRs if label is set
HAS_ARTIFACT_LABEL=$(gh pr view $PR --repo $REPO_URL --json labels | jq '.labels | any(.name == "publish-acir")')
echo "publish=$HAS_ARTIFACT_LABEL" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
REPO_URL: ${{ github.repositoryUrl }}

build-nargo:
name: Build nargo binary
runs-on: ubuntu-22.04
needs: [check-artifacts-requested]
if: ${{ needs.check-artifacts-requested.outputs.publish == true }}
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
Expand Down Expand Up @@ -42,6 +69,7 @@ jobs:
retention-days: 3

auto-pr-rebuild-script:
name: Rebuild ACIR artifacts
needs: [build-nargo]
runs-on: ubuntu-latest

Expand Down Expand Up @@ -71,10 +99,19 @@ jobs:
chmod +x ./rebuild.sh
./rebuild.sh

- name: Upload ACIR artifacts
uses: actions/upload-artifact@v3
with:
name: acir-artifacts
path: ./tooling/nargo_cli/tests/acir_artifacts
retention-days: 10

- name: Check for changes in acir_artifacts directory
id: check_changes
run: |
git diff --quiet tooling/nargo_cli/tests/acir_artifacts/ || echo "::set-output name=changes::true"
if [ ${{ github.ref_name }} == "master" ]; then
git diff --quiet tooling/nargo_cli/tests/acir_artifacts/ || echo "::set-output name=changes::true"
fi

- name: Create or Update PR
if: steps.check_changes.outputs.changes == 'true'
Expand Down
Loading