From 36f33eebd158400188f56f775336133eb42dba3b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 14:15:15 -0700 Subject: [PATCH] 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 }}