mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 20:27:58 -05:00
[Feat] Avoid E2E test runs in CI for /contracts changes that are not in contracts/local-deployments-artifacts (#753)
* first draft * fix * fix * fix * fix * fix * fix * new * tmp test change * Revert "tmp test change" This reverts commit 2f217eab96f959abcc47cc4411968a42ee2136e3. * tmp test change v2 * Revert "tmp test change v2" This reverts commit 58387058bc9ccbcbeb371fad0b67a886563b0d88. * add string quotes * tmp test change v2 * Revert "tmp test change v2" This reverts commit 21575cdb343a2504d496f80d62fb75b9564dbd18. * add * tmp test change v2 * Revert "tmp test change v2" This reverts commit c4be020ed58040e2c53895e39bce44899a327d43. * tst change v3 * Revert "tst change v3" This reverts commit 09985d564dfab22a2887037a1c0fbb013cee9ed5. * fix hyphen typo * tst change v3 * Revert "tst change v3" This reverts commit e3c6a32300144c3a4785c72c61f6a75511f24379. * fix typo * tst change v3 * tst change v3.1 * undo testing v3 changes * change dependency to manual-docker-build-and-e2e-tests * tmp change for path 2 * Revert "tmp change for path 2" This reverts commit ec42e33cc0c07e2bd99df4bd523204dfe784d55f. * tmp change for path 1 * Revert "tmp change for path 1" This reverts commit 797fd766f02334a8decc763e03bfaa78f9ca0a93. * add toggle * Update .github/workflows/get-e2e-toggle.yml Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com> Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> * adjust for comment * more fix --------- Signed-off-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
This commit is contained in:
46
.github/workflows/get-has-changes-requiring-e2e-testing.yml
vendored
Normal file
46
.github/workflows/get-has-changes-requiring-e2e-testing.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: get-has-changes-requiring-e2e-testing
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
has_changes_requiring_build:
|
||||
required: true
|
||||
type: string
|
||||
# Next 3 variables are required to determine if the only file changes that have occurred are in `/contracts` but not `/contracts/local-deployment-artifacts`
|
||||
contracts_excluding_local_deployment_artifacts:
|
||||
required: true
|
||||
type: string
|
||||
changed_file_count:
|
||||
required: false
|
||||
type: string
|
||||
contracts_excluding_local_deployment_artifacts_count:
|
||||
required: false
|
||||
type: string
|
||||
outputs:
|
||||
has-changes-requiring-e2e-testing:
|
||||
value: ${{ jobs.get-has-changes-requiring-e2e-testing.outputs.has_changes_requiring_e2e_testing }}
|
||||
|
||||
jobs:
|
||||
get-has-changes-requiring-e2e-testing:
|
||||
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-small
|
||||
outputs:
|
||||
has_changes_requiring_e2e_testing: ${{ steps.eval.outputs.has_changes_requiring_e2e_testing }}
|
||||
steps:
|
||||
- name: Evaluate Toggle State
|
||||
id: eval
|
||||
shell: bash
|
||||
run: |
|
||||
has_changes_requiring_build=${{ inputs.has_changes_requiring_build }}
|
||||
contracts_excluding_local_deployment_artifacts=${{ inputs.contracts_excluding_local_deployment_artifacts }}
|
||||
changed_file_count=${{ inputs.changed_file_count }}
|
||||
contracts_excluding_local_deployment_artifacts_count=${{ inputs.contracts_excluding_local_deployment_artifacts_count }}
|
||||
HAS_CHANGES_REQUIRING_E2E_TESTING="true"
|
||||
|
||||
if [[ "$has_changes_requiring_build" == "false" ]]; then
|
||||
HAS_CHANGES_REQUIRING_E2E_TESTING="false"
|
||||
elif [[ "$contracts_excluding_local_deployment_artifacts" == "true" && "$changed_file_count" == "$contracts_excluding_local_deployment_artifacts_count" ]]; then
|
||||
HAS_CHANGES_REQUIRING_E2E_TESTING="false"
|
||||
fi
|
||||
|
||||
echo "has_changes_requiring_e2e_testing=$HAS_CHANGES_REQUIRING_E2E_TESTING"
|
||||
echo "has_changes_requiring_e2e_testing=$HAS_CHANGES_REQUIRING_E2E_TESTING" >> $GITHUB_OUTPUT
|
||||
75
.github/workflows/main.yml
vendored
75
.github/workflows/main.yml
vendored
@@ -14,14 +14,17 @@ jobs:
|
||||
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-small
|
||||
name: Filter commit changes
|
||||
outputs:
|
||||
changed-file-count: ${{ steps.filter.outputs.all_count }}
|
||||
coordinator: ${{ steps.filter.outputs.coordinator }}
|
||||
staterecovery: ${{ steps.filter.outputs.staterecovery }}
|
||||
postman: ${{ steps.filter.outputs.postman }}
|
||||
prover: ${{ steps.filter.outputs.prover }}
|
||||
traces-api-facade: ${{ steps.filter.outputs.traces-api-facade }}
|
||||
transaction-exclusion-api: ${{ steps.filter.outputs.transaction-exclusion-api }}
|
||||
has-changes-requiring-build: ${{ steps.exclusion-filter.outputs.has-changes-requiring-build }}
|
||||
contracts-excluding-local-deployment-artifacts: ${{ steps.exclusion-filter.outputs.contracts-excluding-local-deployment-artifacts }}
|
||||
contracts-excluding-local-deployment-artifacts-count: ${{ steps.exclusion-filter.outputs.contracts-excluding-local-deployment-artifacts_count }}
|
||||
smart-contracts: ${{ steps.filter.outputs.smart-contracts }}
|
||||
has-changes-requiring-build: ${{ steps.filter-out.outputs.has-changes-requiring-build }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -32,6 +35,8 @@ jobs:
|
||||
base: ${{ github.ref }}
|
||||
list-files: "json"
|
||||
filters: |
|
||||
all:
|
||||
- '**/**'
|
||||
coordinator:
|
||||
- 'coordinator/**'
|
||||
- 'testdata/**'
|
||||
@@ -125,7 +130,7 @@ jobs:
|
||||
|
||||
- name: Filter out commit changes
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter-out
|
||||
id: exclusion-filter
|
||||
with:
|
||||
base: ${{ github.ref }}
|
||||
list-files: "json"
|
||||
@@ -135,7 +140,12 @@ jobs:
|
||||
- '!**/*.mdx'
|
||||
- '!**/docs/**'
|
||||
- '!docs/**'
|
||||
# Enables us to exclude changes in multiple file types if required
|
||||
contracts-excluding-local-deployment-artifacts:
|
||||
- 'contracts/**'
|
||||
- '!contracts/local-deployments-artifacts/**'
|
||||
# Means that ALL (and not just one) filter patterns must match. In other words applies the 'AND' operator to filter patterns.
|
||||
# The default is 'some', which requires just one filter pattern match and applies the 'OR' operator.
|
||||
# For 'has-changes-requiring-build', it means we have an exclusion list that we can append to.
|
||||
predicate-quantifier: 'every'
|
||||
|
||||
check-and-tag-images:
|
||||
@@ -153,10 +163,34 @@ jobs:
|
||||
transaction_exclusion_api_changed: ${{ needs.filter-commit-changes.outputs.transaction-exclusion-api }}
|
||||
secrets: inherit
|
||||
|
||||
testing:
|
||||
needs: [ store-image-name-and-tags, filter-commit-changes, check-and-tag-images ]
|
||||
if: ${{ always() && needs.filter-commit-changes.outputs.has-changes-requiring-build == 'true' }}
|
||||
uses: ./.github/workflows/testing.yml
|
||||
with:
|
||||
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
|
||||
coordinator_changed: ${{ needs.filter-commit-changes.outputs.coordinator }}
|
||||
postman_changed: ${{ needs.filter-commit-changes.outputs.postman }}
|
||||
prover_changed: ${{ needs.filter-commit-changes.outputs.prover }}
|
||||
smart_contracts_changed: ${{ needs.filter-commit-changes.outputs.smart-contracts }}
|
||||
staterecovery_changed: ${{ needs.filter-commit-changes.outputs.staterecovery }}
|
||||
traces_api_facade_changed: ${{ needs.filter-commit-changes.outputs.traces-api-facade }}
|
||||
transaction_exclusion_api_changed: ${{ needs.filter-commit-changes.outputs.transaction-exclusion-api }}
|
||||
secrets: inherit
|
||||
|
||||
get-has-changes-requiring-e2e-testing:
|
||||
needs: [ filter-commit-changes ]
|
||||
uses: ./.github/workflows/get-has-changes-requiring-e2e-testing.yml
|
||||
with:
|
||||
has_changes_requiring_build: ${{ needs.filter-commit-changes.outputs.has-changes-requiring-build }}
|
||||
contracts_excluding_local_deployment_artifacts: ${{ needs.filter-commit-changes.outputs.contracts-excluding-local-deployment-artifacts }}
|
||||
changed_file_count: ${{ needs.filter-commit-changes.outputs.changed-file-count }}
|
||||
contracts_excluding_local_deployment_artifacts_count: ${{ needs.filter-commit-changes.outputs.contracts-excluding-local-deployment-artifacts-count }}
|
||||
|
||||
manual-docker-build-and-e2e-tests:
|
||||
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-small
|
||||
needs: [ store-image-name-and-tags, filter-commit-changes, check-and-tag-images ]
|
||||
if: ${{ needs.filter-commit-changes.outputs.has-changes-requiring-build == 'true' }}
|
||||
needs: [ store-image-name-and-tags, check-and-tag-images, get-has-changes-requiring-e2e-testing ]
|
||||
if: ${{ needs.get-has-changes-requiring-e2e-testing.outputs.has-changes-requiring-e2e-testing == 'true' }}
|
||||
environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }}
|
||||
concurrency:
|
||||
group: manual-docker-build-and-e2e-tests-${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -184,25 +218,10 @@ jobs:
|
||||
transaction_exclusion_api_image_tagged: ${{ needs.check-and-tag-images.outputs.image_tagged_transaction_exclusion_api }}
|
||||
secrets: inherit
|
||||
|
||||
testing:
|
||||
needs: [ store-image-name-and-tags, filter-commit-changes, check-and-tag-images ]
|
||||
if: ${{ always() && needs.filter-commit-changes.outputs.has-changes-requiring-build == 'true' }}
|
||||
uses: ./.github/workflows/testing.yml
|
||||
with:
|
||||
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
|
||||
coordinator_changed: ${{ needs.filter-commit-changes.outputs.coordinator }}
|
||||
postman_changed: ${{ needs.filter-commit-changes.outputs.postman }}
|
||||
prover_changed: ${{ needs.filter-commit-changes.outputs.prover }}
|
||||
smart_contracts_changed: ${{ needs.filter-commit-changes.outputs.smart-contracts }}
|
||||
staterecovery_changed: ${{ needs.filter-commit-changes.outputs.staterecovery }}
|
||||
traces_api_facade_changed: ${{ needs.filter-commit-changes.outputs.traces-api-facade }}
|
||||
transaction_exclusion_api_changed: ${{ needs.filter-commit-changes.outputs.transaction-exclusion-api }}
|
||||
secrets: inherit
|
||||
|
||||
run-e2e-tests-geth-tracing:
|
||||
needs: [ store-image-name-and-tags, docker-build, manual-docker-build-and-e2e-tests, filter-commit-changes ]
|
||||
# Make this execute for has-changes-requiring-build == 'false' so that we can get to the required job @ which is in reuse-run-e2e-tests.yml
|
||||
if: ${{ always() && needs.filter-commit-changes.outputs.has-changes-requiring-build == 'false' || needs.docker-build.result == 'success' }}
|
||||
needs: [ store-image-name-and-tags, docker-build, get-has-changes-requiring-e2e-testing, manual-docker-build-and-e2e-tests ]
|
||||
# Make this execute for has-changes-requiring-e2e-testing == 'false' so that we can get to the required job @ which is in reuse-run-e2e-tests.yml
|
||||
if: ${{ always() && needs.get-has-changes-requiring-e2e-testing.outputs.has-changes-requiring-e2e-testing == 'false' || needs.docker-build.result == 'success' }}
|
||||
concurrency:
|
||||
group: run-e2e-tests-geth-tracing-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
@@ -211,13 +230,13 @@ jobs:
|
||||
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
|
||||
tracing-engine: 'geth'
|
||||
e2e-tests-logs-dump: true
|
||||
has-changes-requiring-build: ${{ needs.filter-commit-changes.outputs.has-changes-requiring-build }}
|
||||
has-changes-requiring-e2e-testing: ${{ needs.get-has-changes-requiring-e2e-testing.outputs.has-changes-requiring-e2e-testing }}
|
||||
secrets: inherit
|
||||
|
||||
run-e2e-tests:
|
||||
needs: [ store-image-name-and-tags, docker-build, manual-docker-build-and-e2e-tests, filter-commit-changes ]
|
||||
# Make this execute for has-changes-requiring-build == 'false' so that we can get to the required job @ which is in reuse-run-e2e-tests.yml
|
||||
if: ${{ always() && needs.filter-commit-changes.outputs.has-changes-requiring-build == 'false' || needs.docker-build.result == 'success' }}
|
||||
needs: [ store-image-name-and-tags, docker-build, get-has-changes-requiring-e2e-testing, manual-docker-build-and-e2e-tests ]
|
||||
# Make this execute for has-changes-requiring-e2e-testing == 'false' so that we can get to the required job @ which is in reuse-run-e2e-tests.yml
|
||||
if: ${{ always() && needs.get-has-changes-requiring-e2e-testing.outputs.has-changes-requiring-e2e-testing == 'false' || needs.docker-build.result == 'success' }}
|
||||
concurrency:
|
||||
group: run-e2e-tests-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
@@ -226,7 +245,7 @@ jobs:
|
||||
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
|
||||
tracing-engine: 'besu'
|
||||
e2e-tests-logs-dump: true
|
||||
has-changes-requiring-build: ${{ needs.filter-commit-changes.outputs.has-changes-requiring-build }}
|
||||
has-changes-requiring-e2e-testing: ${{ needs.get-has-changes-requiring-e2e-testing.outputs.has-changes-requiring-e2e-testing }}
|
||||
secrets: inherit
|
||||
|
||||
publish-images-after-run-tests-success-on-main:
|
||||
|
||||
4
.github/workflows/reuse-run-e2e-tests.yml
vendored
4
.github/workflows/reuse-run-e2e-tests.yml
vendored
@@ -49,7 +49,7 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
has-changes-requiring-build:
|
||||
has-changes-requiring-e2e-testing:
|
||||
type: string
|
||||
outputs:
|
||||
tests_outcome:
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
# Required job
|
||||
run-e2e-tests:
|
||||
# We can only use conditionals, and not path filters to 'successfully' skip a required job - https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
if: ${{ inputs.has-changes-requiring-build == 'true' }}
|
||||
if: ${{ inputs.has-changes-requiring-e2e-testing == 'true' }}
|
||||
env:
|
||||
COORDINATOR_TAG: ${{ inputs.commit_tag }}
|
||||
POSTMAN_TAG: ${{ inputs.commit_tag }}
|
||||
|
||||
Reference in New Issue
Block a user