From 4efa7a27e7c358d9552cdf1f3b8f0d2081416d4f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 14:15:15 -0700 Subject: [PATCH 1/5] update workflow to build template on dependabot prs --- .../determine_workflow_config/action.yml | 6 +++ .github/workflows/test.yml | 38 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/actions/determine_workflow_config/action.yml b/.github/actions/determine_workflow_config/action.yml index aa4e8f1b42..a7a18810df 100644 --- a/.github/actions/determine_workflow_config/action.yml +++ b/.github/actions/determine_workflow_config/action.yml @@ -38,6 +38,9 @@ outputs: fuzz: description: 'Whether to run fuzz tests' value: ${{ steps.determine_workflow_config.outputs.fuzz }} + is-dependabot: + description: 'Whether the commit is from Dependabot' + value: ${{ steps.determine_workflow_config.outputs.is-dependabot }} runs: using: 'composite' @@ -54,6 +57,7 @@ runs: echo "exclude-release-only=${{ inputs.exclude-release-only-dispatch-input-value }}" >> $GITHUB_OUTPUT echo "link-azle=${{ inputs.link-azle-dispatch-input-value }}" >> $GITHUB_OUTPUT echo "fuzz=${{ inputs.fuzz-dispatch-input-value }}" >> $GITHUB_OUTPUT + echo "is-dependabot=false" >> $GITHUB_OUTPUT else EXCLUDE_SLOW=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' }} EXCLUDE_UNSTABLE=${{ steps.workflow-context.outputs.is_feature_branch_draft_pr == 'true' || steps.workflow-context.outputs.is_feature_branch_pr == 'true' }} @@ -69,6 +73,7 @@ runs: echo "link-azle=true" >> $GITHUB_OUTPUT fi echo "fuzz=false" >> $GITHUB_OUTPUT + echo "is-dependabot=${{ github.actor == 'dependabot[bot]' }}" >> $GITHUB_OUTPUT fi - id: echo-outputs @@ -80,3 +85,4 @@ runs: echo "exclude-release-only: ${{ steps.determine_workflow_config.outputs.exclude-release-only }}" echo "link-azle: ${{ steps.determine_workflow_config.outputs.link-azle }}" echo "fuzz: ${{ steps.determine_workflow_config.outputs.fuzz }}" + echo "is-dependabot: ${{ steps.determine_workflow_config.outputs.is-dependabot }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 483b532e80..63084dac2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,6 +53,7 @@ jobs: exclude-release-only: ${{ steps.determine-workflow-config.outputs.exclude-release-only }} link-azle: ${{ steps.determine-workflow-config.outputs.link-azle }} fuzz: ${{ steps.determine-workflow-config.outputs.fuzz }} + is-dependabot: ${{ steps.determine-workflow-config.outputs.is-dependabot }} steps: - uses: actions/checkout@v4 @@ -66,9 +67,44 @@ jobs: link-azle-dispatch-input-value: ${{ inputs.link-azle }} fuzz-dispatch-input-value: ${{ inputs.fuzz }} + build-templates: + name: Build templates for Dependabot + needs: workflow-config + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + - uses: ./.github/actions/setup_node + + - uses: ./.github/actions/setup_dfx + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + - name: Build stable template + run: AZLE_VERBOSE=true npx azle template + + - name: Build experimental template + run: AZLE_VERBOSE=true npx azle template --experimental + + - uses: ./.github/actions/commit_and_push + with: + branch-name: ${{ github.head_ref }} + commit-message: 'chore: update templates for dependency changes' + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + get-exclude-dirs: name: Get exclude directories - needs: workflow-config + needs: + - workflow-config + - build-templates runs-on: ubuntu-latest outputs: exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }} From 38cc47c8d51f01465d3ade82dc574d788950c7a1 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 14:28:20 -0700 Subject: [PATCH 2/5] skips steps of build-template job so dependent jobs will still run --- .github/workflows/test.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63084dac2c..7b47d163c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,31 +70,38 @@ jobs: build-templates: name: Build templates for Dependabot needs: workflow-config - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} with: ref: ${{ github.head_ref }} token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - uses: ./.github/actions/setup_node + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - uses: ./.github/actions/setup_dfx + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - run: npm install + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - name: Install global dependencies + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} run: | AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - name: Build stable template + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} run: AZLE_VERBOSE=true npx azle template - name: Build experimental template + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} run: AZLE_VERBOSE=true npx azle template --experimental - uses: ./.github/actions/commit_and_push + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} with: branch-name: ${{ github.head_ref }} commit-message: 'chore: update templates for dependency changes' @@ -102,9 +109,7 @@ jobs: get-exclude-dirs: name: Get exclude directories - needs: - - workflow-config - - build-templates + needs: workflow-config runs-on: ubuntu-latest outputs: exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }} @@ -123,6 +128,7 @@ jobs: needs: - workflow-config - get-exclude-dirs + - build-templates strategy: fail-fast: false matrix: From 1c7a9fb821f5f928ebc024f3b1db33f99ce3e9ed Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 15:14:46 -0700 Subject: [PATCH 3/5] echo actor --- .github/actions/determine_workflow_config/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/determine_workflow_config/action.yml b/.github/actions/determine_workflow_config/action.yml index a7a18810df..aef7a6dd1a 100644 --- a/.github/actions/determine_workflow_config/action.yml +++ b/.github/actions/determine_workflow_config/action.yml @@ -73,6 +73,7 @@ runs: echo "link-azle=true" >> $GITHUB_OUTPUT fi echo "fuzz=false" >> $GITHUB_OUTPUT + echo ${{ github.actor }} echo "is-dependabot=${{ github.actor == 'dependabot[bot]' }}" >> $GITHUB_OUTPUT fi From 896c228859b6189cfd36fa1effbaa1a295bf5bfd Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 15:24:35 -0700 Subject: [PATCH 4/5] make a new workflow for building templates on dependabot runs --- .github/workflows/build_templates.yml | 63 +++++++++++++++++++++++++++ .github/workflows/test.yml | 42 ------------------ 2 files changed, 63 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build_templates.yml diff --git a/.github/workflows/build_templates.yml b/.github/workflows/build_templates.yml new file mode 100644 index 0000000000..41c5ef47e1 --- /dev/null +++ b/.github/workflows/build_templates.yml @@ -0,0 +1,63 @@ +name: Build Templates + +on: + push: + branches: + - main + pull_request: + types: + - opened + - synchronize + - ready_for_review + - reopened + +jobs: + workflow-config: + name: Determine workflow config + runs-on: ubuntu-latest + outputs: + is-dependabot: ${{ steps.determine-workflow-config.outputs.is-dependabot }} + steps: + - uses: actions/checkout@v4 + + - id: determine-workflow-config + uses: ./.github/actions/determine_workflow_config + with: + is-workflow-dispatch: false + exclude-slow-dispatch-input-value: true + exclude-unstable-dispatch-input-value: true + exclude-release-only-dispatch-input-value: true + link-azle-dispatch-input-value: true + + build-templates: + name: Build templates for Dependabot + needs: workflow-config + if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + - uses: ./.github/actions/setup_node + + - uses: ./.github/actions/setup_dfx + + - run: npm install + + - name: Install global dependencies + run: | + AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic + + - name: Build stable template + run: AZLE_VERBOSE=true npx azle template + + - name: Build experimental template + run: AZLE_VERBOSE=true npx azle template --experimental + + - uses: ./.github/actions/commit_and_push + with: + branch-name: ${{ github.head_ref }} + commit-message: 'chore: update templates for dependency changes' + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b47d163c6..483b532e80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,6 @@ jobs: exclude-release-only: ${{ steps.determine-workflow-config.outputs.exclude-release-only }} link-azle: ${{ steps.determine-workflow-config.outputs.link-azle }} fuzz: ${{ steps.determine-workflow-config.outputs.fuzz }} - is-dependabot: ${{ steps.determine-workflow-config.outputs.is-dependabot }} steps: - uses: actions/checkout@v4 @@ -67,46 +66,6 @@ jobs: link-azle-dispatch-input-value: ${{ inputs.link-azle }} fuzz-dispatch-input-value: ${{ inputs.fuzz }} - build-templates: - name: Build templates for Dependabot - needs: workflow-config - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - with: - ref: ${{ github.head_ref }} - token: ${{ secrets.LASTMJS_GITHUB_TOKEN }} - - - uses: ./.github/actions/setup_node - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - - - uses: ./.github/actions/setup_dfx - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - - - run: npm install - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - - - name: Install global dependencies - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - run: | - AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic - - - name: Build stable template - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - run: AZLE_VERBOSE=true npx azle template - - - name: Build experimental template - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - run: AZLE_VERBOSE=true npx azle template --experimental - - - uses: ./.github/actions/commit_and_push - if: ${{ needs.workflow-config.outputs.is-dependabot == 'true' }} - with: - branch-name: ${{ github.head_ref }} - commit-message: 'chore: update templates for dependency changes' - gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} - get-exclude-dirs: name: Get exclude directories needs: workflow-config @@ -128,7 +87,6 @@ jobs: needs: - workflow-config - get-exclude-dirs - - build-templates strategy: fail-fast: false matrix: From c61df5d6354ab6d7972702398da2e91a238511fe Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 15:29:00 -0700 Subject: [PATCH 5/5] pr fixes --- .github/workflows/build_templates.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_templates.yml b/.github/workflows/build_templates.yml index 41c5ef47e1..da630e8d18 100644 --- a/.github/workflows/build_templates.yml +++ b/.github/workflows/build_templates.yml @@ -1,9 +1,6 @@ name: Build Templates on: - push: - branches: - - main pull_request: types: - opened @@ -24,10 +21,10 @@ jobs: uses: ./.github/actions/determine_workflow_config with: is-workflow-dispatch: false - exclude-slow-dispatch-input-value: true - exclude-unstable-dispatch-input-value: true - exclude-release-only-dispatch-input-value: true - link-azle-dispatch-input-value: true + exclude-slow-dispatch-input-value: false + exclude-unstable-dispatch-input-value: false + exclude-release-only-dispatch-input-value: false + link-azle-dispatch-input-value: false build-templates: name: Build templates for Dependabot