ci: rework chain type matrix in CI runs (#9704)

* ci: remove polygon edge and suave from CI runs

* ci: run chain type workflows based on pr labels

* chore: keep suave and polygon_edge as optional

* ci: update matrix selection logic

* ci: re-run ci if PR is relabeled

* ci: fix default chain type

* ci: refactor default chain types
pull/9771/head
Kirill Fedoseev 7 months ago committed by GitHub
parent ea97da95ea
commit 92ac44cca9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 40
      .github/workflows/config.yml
  2. 3
      PULL_REQUEST_TEMPLATE.md

@ -26,6 +26,7 @@ on:
- 'docker/*'
- 'docker-compose/*'
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- master
- production-optimism
@ -46,9 +47,30 @@ jobs:
steps:
- id: set-matrix
run: |
echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
env:
matrixStringifiedObject: '{"chain-type": ["ethereum", "polygon_edge", "polygon_zkevm", "rsk", "suave", "stability", "filecoin", "optimism"]}'
echo "matrix=$(node -e '
// Add/remove CI matrix chain types here
const defaultChainTypes = ["default"];
const chainTypes = ["ethereum", "polygon_zkevm", "rsk", "stability", "filecoin", "optimism"];
const extraChainTypes = ["suave", "polygon_edge"];
// Chain type matrix we use in master branch
const allChainTypes = [].concat(defaultChainTypes, chainTypes, extraChainTypes);
const labels = ${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.labels.*.name) || '[]' }};
const ciLabels = labels.filter(label => label.startsWith("ci:"));
const labeledChainTypes = [].concat(
defaultChainTypes.filter(chainType => ciLabels.includes("ci:" + chainType)),
chainTypes.filter(chainType => ciLabels.includes("ci:all") || ciLabels.includes("ci:" + chainType)),
extraChainTypes.filter(chainType => ciLabels.includes("ci:" + chainType))
);
// Chain type matrix we use in PRs to master branch
const ciChainTypes = labeledChainTypes.length > 0 ? labeledChainTypes : defaultChainTypes;
const matrix = { "chain-type": ${{ github.event_name == 'pull_request' && 'ciChainTypes' || 'allChainTypes' }} };
console.log(JSON.stringify(matrix));
')" >> $GITHUB_OUTPUT
build-and-cache:
name: Build and Cache deps
@ -215,12 +237,12 @@ jobs:
mkdir -p priv/plts
mix dialyzer --plt
env:
CHAIN_TYPE: ${{ matrix.chain-type }}
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
- name: Run Dialyzer
run: mix dialyzer --halt-exit-status
env:
CHAIN_TYPE: ${{ matrix.chain-type }}
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
gettext:
name: Missing translation keys check
@ -486,7 +508,7 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
test_nethermind_mox_explorer:
strategy:
fail-fast: false
@ -560,7 +582,7 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
test_nethermind_mox_indexer:
strategy:
fail-fast: false
@ -626,7 +648,7 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}
test_nethermind_mox_block_scout_web:
strategy:
fail-fast: false
@ -725,4 +747,4 @@ jobs:
ACCOUNT_ENABLED: "true"
ACCOUNT_REDIS_URL: "redis://localhost:6379"
SOURCIFY_INTEGRATION_ENABLED: "true"
CHAIN_TYPE: "${{ matrix.chain-type }}"
CHAIN_TYPE: ${{ matrix.chain-type != 'default' && matrix.chain-type || '' }}

@ -25,4 +25,5 @@
- [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
- [ ] I checked whether I should update the docs and did so by submitting a PR to https://github.com/blockscout/docs
- [ ] If I added/changed/removed ENV var, I submitted a PR to https://github.com/blockscout/docs to update the list of env vars at https://github.com/blockscout/docs/blob/master/for-developers/information-and-settings/env-variables.md and I updated the version to `master` in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.
- [ ] If I add new indices into DB, I checked, that they are not redundant with PGHero or other tools
- [ ] If I added new DB indices, I checked, that they are not redundant with PGHero or other tools.
- [ ] If I added/removed chain type, I modified the Github CI matrix and PR labels accordingly.

Loading…
Cancel
Save