From 2affc4469954d2949edd2d55b3f5a3edf58f6ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Sporny?= Date: Tue, 22 Oct 2024 12:31:13 +0200 Subject: [PATCH] add: wait for next epoch --- .../actions/tests/run-e2e-tests/action.yml | 8 ++- .../actions/tests/wait-for-epoch/action.yml | 4 +- .github/workflows/cd.yml | 57 ++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/.github/actions/tests/run-e2e-tests/action.yml b/.github/actions/tests/run-e2e-tests/action.yml index 45a11f0b0..09a6375e3 100644 --- a/.github/actions/tests/run-e2e-tests/action.yml +++ b/.github/actions/tests/run-e2e-tests/action.yml @@ -16,6 +16,9 @@ inputs: mc_epoch: description: 'MC epoch to test (committee tests)' required: false + latest_mc_epoch: + description: 'Parametrize committee tests to verify whole last MC epoch' + required: false deployment_mc_epoch: description: 'Deployment MC epoch' required: false @@ -33,7 +36,6 @@ inputs: decrypt: description: 'Decrypt secrets' required: false - default: 'false' runs: using: composite @@ -44,6 +46,9 @@ runs: if [ -n "${{ inputs.mc_epoch }}" ]; then mc_epoch_switch="--mc-epoch ${{ inputs.mc_epoch }}" fi + if [ "${{ inputs.latest_mc_epoch }}" = "true" ]; then + latest_mc_epoch_switch="--latest-mc-epoch" + fi if [ -n "${{ inputs.deployment_mc_epoch }}" ]; then deployment_mc_epoch_switch="--deployment-mc-epoch ${{ inputs.deployment_mc_epoch }}" fi @@ -61,6 +66,7 @@ runs: -m "${{ inputs.markers }}" \ --init-timestamp ${{ inputs.init_timestamp }} \ $mc_epoch_switch \ + $latest_mc_epoch_switch \ $decrypt_switch \ --json-report \ --json-report-summary \ diff --git a/.github/actions/tests/wait-for-epoch/action.yml b/.github/actions/tests/wait-for-epoch/action.yml index 7501c5491..818d353fe 100644 --- a/.github/actions/tests/wait-for-epoch/action.yml +++ b/.github/actions/tests/wait-for-epoch/action.yml @@ -32,9 +32,9 @@ runs: elif [ "${{ inputs.deployment }}" == "kubernetes" ]; then if [ "${{ inputs.environment }}" == "staging-preview" ]; then - testnet_magic=1 - elif [ "${{ inputs.environment }}" == "staging-preprod" ]; then testnet_magic=2 + elif [ "${{ inputs.environment }}" == "staging-preprod" ]; then + testnet_magic=1 else echo "Invalid environment for Kubernetes deployment" exit 1 diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3642a68c0..96a14533d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -257,7 +257,62 @@ jobs: decrypt: true markers: "not active_flow and not passive_flow" deployment_mc_epoch: ${{ env.DEPLOYMENT_MC_EPOCH }} - + + wait-for-next-epoch: + permissions: + id-token: write + contents: read + needs: partner-chain-ready + runs-on: [self-hosted, eks] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set MC epoch to wait for + id: increment-epoch + run: | + echo "Current epoch: $DEPLOYMENT_MC_EPOCH" + incremented_epoch=$((DEPLOYMENT_MC_EPOCH + 1)) + echo "Incremented epoch: $incremented_epoch" + echo "::set-output name=epoch::$incremented_epoch" + - name: Wait for next MC epoch + uses: ./.github/actions/tests/wait-for-epoch + with: + epoch: ${{ steps.increment-epoch.outputs.epoch }}" + deployment: kubernetes + node: staging-preview-validator-1 + environment: staging-preview + + run-all-tests-2: + permissions: + id-token: write + contents: read + needs: wait-for-next-epoch + runs-on: [self-hosted, eks] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Configure kubectl + uses: ./.github/actions/tests/staging-preview-tests + with: + node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST + node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT + env: + kubeconfig_base64: ${{ secrets.kubeconfig_base64 }} + K8S_SERVER: ${{ secrets.K8S_SERVER }} + K8S_SA_TOKEN: ${{ secrets.K8S_SA_TOKEN }} + - name: Setup tests + uses: ./.github/actions/tests/setup-python + env: + ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }} + - name: Run all tests (some skipped due to new deployment) + uses: ./.github/actions/tests/run-e2e-tests + with: + blockchain: substrate + env: staging + decrypt: true + latest_mc_epoch: true + markers: "not active_flow and not passive_flow" + deployment_mc_epoch: ${{ env.DEPLOYMENT_MC_EPOCH }} # build-and-publish-ghcr: # permissions: