diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 0f2ad51ee0..a86ad29b1d 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -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 || '' }} diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index bfc691bd1d..6e15223f20 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -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.