Skip to content

Commit

Permalink
ci(repo): improve workflow triggering conditions (#18385)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Nov 4, 2024
1 parent 8dd14a1 commit 9b843d6
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 62 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/bridge-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,27 @@ on:

jobs:
build-and-test:
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
uses: ./.github/workflows/bridge-ui--ci.yml

# Deployment name follow the pattern: deploy_<appname(bridge-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>

# Internal Devnet
deploy_bridge-ui_devnet_preview:
if: ${{ github.ref_type != 'tag' }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "preview"
flags: ""
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_BRIDGE_UI_INTERNAL }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
# deploy_bridge-ui_devnet_preview:
# if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
# needs: build-and-test
# uses: ./.github/workflows/repo--vercel-deploy.yml
# with:
# environment: "preview"
# flags: ""
# secrets:
# vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_BRIDGE_UI_INTERNAL }}
# vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
# vercel_token: ${{ secrets.VERCEL_TOKEN }}

# Hekla testnet
deploy_bridge-ui_hekla_preview:
if: ${{ github.ref_type != 'tag' }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
Expand All @@ -60,7 +61,7 @@ jobs:

# Mainnet
deploy_bridge-ui_mainnet_preview:
if: ${{ github.ref_type != 'tag' }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/docs-site--preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DOCS_SITE }}

on:
push:
branches-ignore:
- main
- release-please-*
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/docs-site/**"

jobs:
deploy-docs-site-preview:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
steps:
- name: Install Git
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/fork-diff--preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_FORK_DIFF }}

on:
workflow_dispatch:
push:
branches-ignore:
- main
- release-please-*
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/fork-diff/**"

jobs:
deploy-fork-diff-preview:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
steps:
- name: Install Git
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/guardian-prover-health-check-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@ jobs:
uses: ./.github/workflows/guardian-prover-health-check-ui--ci.yml

# Deployment name follow the pattern: deploy_<appname(guardian-prover-health-check-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>
deploy_guardians-ui_mainnet_preview:
if: ${{ github.ref_name != 'main' }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "preview"
flags: ""
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_GUARDIAN_UI_MAINNET }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}

# deploy_guardians-ui_devnet_preview:
# if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
# needs: build-and-test
# uses: ./.github/workflows/repo--vercel-deploy.yml
# with:
# environment: "preview"
# flags: ""
# secrets:
# vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_GUARDIAN_UI_INTERNAL }}
# vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
# vercel_token: ${{ secrets.VERCEL_TOKEN }}



deploy_guardians-ui_hekla_preview:
if: ${{ github.ref_name != 'main' }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
Expand All @@ -37,15 +40,15 @@ jobs:
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}

deploy_guardians-ui_devnet_preview:
if: ${{ github.ref_name != 'main' }}
deploy_guardians-ui_mainnet_preview:
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "preview"
flags: ""
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_GUARDIAN_UI_INTERNAL }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_GUARDIAN_UI_MAINNET }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/guardian-prover-health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
lint-guardian-prover-health-check:
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
name: lint-guardian-prover-health-check
runs-on: [taiko-runner]
steps:
Expand All @@ -33,6 +34,7 @@ jobs:
args: --config=.golangci.yml --timeout=4m

test-guardian-prover-health-check:
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
runs-on: [taiko-runner]
needs: lint-guardian-prover-health-check
steps:
Expand All @@ -58,7 +60,7 @@ jobs:

push-guardian-prover-health-check-docker-image:
# Skip dependabot PRs
if: ${{ github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/dependabot/') }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
name: Build and push docker image
runs-on: [taiko-runner]

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nfts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/nfts/**"
- "!packages/nfts/contract_layout_*"

jobs:
build-nfts-contracts:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
steps:
- name: Cancel previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol-monitors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
deploy-protocol-monitors:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [taiko-runner]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/protocol/**"
- "!packages/protocol/contract_layout_*"
- "!packages/protocol/audit/**"
- "!packages/protocol/docs/**"
- "!packages/protocol/simulation/**"
- "!packages/protocol/deployments/**"

jobs:
build-protocol:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down Expand Up @@ -66,7 +67,7 @@ jobs:
pnpm test:deploy:l1
genesis-docker:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [taiko-runner]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
lint-relayer:
name: lint-relayer
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
runs-on: [arc-runner-set]
steps:
- uses: actions/setup-go@v5
Expand All @@ -35,7 +35,7 @@ jobs:
args: --config=.golangci.yml --timeout=4m

test-relayer:
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
runs-on: [arc-runner-set]
needs: lint-relayer
steps:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:

push-relayer-docker-image:
# Skip dependabot PRs
if: ${{ github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/dependabot/') }}
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
name: Build and push docker image
runs-on: [arc-runner-set]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/repo--do-not-merge-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
check_label:
if: github.event.pull_request.draft == false
runs-on: [arc-runner-set]
steps:
- name: Check for "option.do-not-merge" label
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/repo--typo-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [pull_request]

jobs:
check-for-typos:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo--validate-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
validate-pr-title:
if: github.event_name == 'pull_request_target'
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
steps:
- uses: amannn/action-semantic-pull-request@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snaefell-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Deployment name follow the pattern: deploy_<appname(snaefell-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>
# The following Vercel project is not found, so disable it at least for now.
# deploy_snaefell-ui_mainnet_preview:
# if: ${{ github.ref_name != 'main' }}
# if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
# needs: build-and-test
# uses: ./.github/workflows/repo--vercel-deploy.yml
# with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/supplementary-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build-supplementary-contracts:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
runs-on: [arc-runner-set]
steps:
- name: Cancel previous runs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/taiko-client--hive_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
hive_tests:
if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'option.hive-test')
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') && github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
name: hive tests
runs-on: [arc-runner-set]
timeout-minutes: 40
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/taiko-client--test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
lint:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
name: Lint
runs-on: [ubuntu-latest]
steps:
Expand All @@ -30,7 +30,7 @@ jobs:
run: golangci-lint run --path-prefix=./ --config=.golangci.yml

integration_tests:
if: github.event.pull_request.draft == false
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
name: Integration tests
runs-on: [ubuntu-latest]
timeout-minutes: 15
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/taikoon-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
uses: ./.github/workflows/taikoon-ui--ci.yml

# Deployment name follow the pattern: deploy_<appname(taikoon-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>
deploy_taikoon-ui_mainnet_preview:
if: ${{ github.ref_name != 'main' }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "preview"
flags: ""
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_TAIKOON_UI_MAINNET }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
# deploy_taikoon-ui_mainnet_preview:
# if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
# needs: build-and-test
# uses: ./.github/workflows/repo--vercel-deploy.yml
# with:
# environment: "preview"
# flags: ""
# secrets:
# vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_TAIKOON_UI_MAINNET }}
# vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
# vercel_token: ${{ secrets.VERCEL_TOKEN }}

deploy_taikoon-ui_mainnet_production:
if: ${{ startsWith(github.ref, 'refs/tags/taikoon-ui-v') }}
Expand Down

0 comments on commit 9b843d6

Please sign in to comment.