diff --git a/.github/workflows/modules/local-environment-tests.yml b/.github/workflows/modules/local-environment-tests.yml index 2a3889ca2..bca8fe55c 100644 --- a/.github/workflows/modules/local-environment-tests.yml +++ b/.github/workflows/modules/local-environment-tests.yml @@ -13,6 +13,8 @@ on: jobs: local-environment-tests: runs-on: ubuntu-latest + env: + TEST_ENVIRONMENT: demo steps: - name: Checkout master uses: actions/checkout@v4 @@ -60,11 +62,105 @@ jobs: bash setup.sh --non-interactive --overrides --postgres-password=azMpOp4mTqhlKDmgCVQr --node-image=${{ inputs.image }} docker compose up -d - - name: Run e2e tests - runs-on: ubuntu-latest - steps: - - uses: ./partner-chains-master/.github/workflows/modules/run-e2e-tests.yml - secrets: inherit + - name: Checkout e2e tests + uses: actions/checkout@v4 + with: + repository: input-output-hk/sidechains-tests + token: ${{ secrets.ACTIONS_PAT }} + ref: ETCM-8119/run-tests-on-ci + path: e2e-tests + + - name: Setup python and dependencies + run: | + cd e2e-tests + sudo apt update + sudo apt install -y software-properties-common + sudo add-apt-repository ppa:deadsnakes/ppa + sudo apt update + sudo apt install -y python3.10 python3.10-venv python3.10-dev + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 + curl -L --silent https://github.com/getsops/sops/releases/download/v3.7.3/sops_3.7.3_amd64.deb > sops.deb && sudo dpkg -i sops.deb && rm sops.deb + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + + - name: Wait for the PC node 1 to start + run: | + while ! docker exec cardano-node-1 [ -e /shared/cardano.ready ]; do sleep 1; done + echo "Cardano network is ready! Waiting for Partner Chain first node to start..." + INIT_TIMESTAMP=$(docker exec cardano-node-1 cat /shared/cardano.start) + echo "INIT_TIMESTAMP=$INIT_TIMESTAMP" >> $GITHUB_ENV + while ! docker exec partner-chains-node-1 [ -e /shared/partner-chains-node-1.ready ]; do \ + epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch) && \ + echo "Epoch: $epoch" && \ + sleep 10; \ + done + + - name: Run smoke tests + uses: ./partner-chains-master/.github/run-e2e-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + keyword: "test_get_status or test_get_params" + + - name: Wait for epoch 3 + uses: ./partner-chains-masters/.github/wait-for-epoch + with: + epoch: 3 + + - name: Run registration tests + uses: ./partner-chains-master/.github/run-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" + init_timestamp: ${{ env.INIT_TIMESTAMP }} + + - name: Wait for epoch 4 + uses: ./partner-chains-master/.github/wait-for-epoch + with: + epoch: 4 + + - name: Run registration tests + uses: ./partner-chains-master/.github/run-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" + init_timestamp: ${{ env.INIT_TIMESTAMP }} + + - name: Wait for epoch 5 + uses: ./partner-chains-master/.github/wait-for-epoch + with: + epoch: 5 + + - name: Run all tests + uses: ./partner-chains-master/.github/run-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + mc_epoch: 4 + init_timestamp: ${{ env.INIT_TIMESTAMP }} + + - name: Wait for epoch 6 + uses: ./partner-chains-master/.github/wait-for-epoch + with: + epoch: 6 + + - name: Run all tests + uses: ./partner-chains-master/.github/run-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + mc_epoch: 5 + init_timestamp: ${{ env.INIT_TIMESTAMP }} + + - name: Wait for epoch 7 + uses: ./partner-chains-master/.github/wait-for-epoch + with: + epoch: 7 + + - name: Run all tests + uses: ./partner-chains-master/.github/run-tests + with: + env: ${{ env.TEST_ENVIRONMENT }} + mc_epoch: 6 + init_timestamp: ${{ env.INIT_TIMESTAMP }} - name: Stop partner-chains-demo run: docker compose down --volumes \ No newline at end of file diff --git a/.github/workflows/modules/run-e2e-tests.yml b/.github/workflows/modules/run-e2e-tests.yml deleted file mode 100644 index b0cbdc8e0..000000000 --- a/.github/workflows/modules/run-e2e-tests.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Run e2e tests against local environment - -on: - workflow_call: - -jobs: - run-e2e-tests: - runs-on: ubuntu-latest - env: - TEST_ENVIRONMENT: demo - steps: - - name: Checkout e2e tests - uses: actions/checkout@v4 - with: - repository: input-output-hk/sidechains-tests - token: ${{ secrets.ACTIONS_PAT }} - ref: ETCM-8119/run-tests-on-ci - path: e2e-tests - - - name: Setup python and dependencies - run: | - cd e2e-tests - sudo apt update - sudo apt install -y software-properties-common - sudo add-apt-repository ppa:deadsnakes/ppa - sudo apt update - sudo apt install -y python3.10 python3.10-venv python3.10-dev - sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - curl -L --silent https://github.com/getsops/sops/releases/download/v3.7.3/sops_3.7.3_amd64.deb > sops.deb && sudo dpkg -i sops.deb && rm sops.deb - python -m venv venv - source venv/bin/activate - pip install -r requirements.txt - - - name: Wait for the PC node 1 to start - run: | - while ! docker exec cardano-node-1 [ -e /shared/cardano.ready ]; do sleep 1; done - echo "Cardano network is ready! Waiting for Partner Chain first node to start..." - INIT_TIMESTAMP=$(docker exec cardano-node-1 cat /shared/cardano.start) - echo "INIT_TIMESTAMP=$INIT_TIMESTAMP" >> $GITHUB_ENV - while ! docker exec partner-chains-node-1 [ -e /shared/partner-chains-node-1.ready ]; do \ - epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch) && \ - echo "Epoch: $epoch" && \ - sleep 10; \ - done - - - name: Run smoke tests - uses: ./partner-chains-master/.github/run-e2e-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - keyword: "test_get_status or test_get_params" - - - name: Wait for epoch 3 - uses: ./partner-chains-masters/.github/wait-for-epoch - with: - epoch: 3 - - - name: Run registration tests - uses: ./partner-chains-master/.github/run-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" - init_timestamp: ${{ env.INIT_TIMESTAMP }} - - - name: Wait for epoch 4 - uses: ./partner-chains-master/.github/wait-for-epoch - with: - epoch: 4 - - - name: Run registration tests - uses: ./partner-chains-master/.github/run-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" - init_timestamp: ${{ env.INIT_TIMESTAMP }} - - - name: Wait for epoch 5 - uses: ./partner-chains-master/.github/wait-for-epoch - with: - epoch: 5 - - - name: Run all tests - uses: ./partner-chains-master/.github/run-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - mc_epoch: 4 - init_timestamp: ${{ env.INIT_TIMESTAMP }} - - - name: Wait for epoch 6 - uses: ./partner-chains-master/.github/wait-for-epoch - with: - epoch: 6 - - - name: Run all tests - uses: ./partner-chains-master/.github/run-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - mc_epoch: 5 - init_timestamp: ${{ env.INIT_TIMESTAMP }} - - - name: Wait for epoch 7 - uses: ./partner-chains-master/.github/wait-for-epoch - with: - epoch: 7 - - - name: Run all tests - uses: ./partner-chains-master/.github/run-tests - with: - env: ${{ env.TEST_ENVIRONMENT }} - mc_epoch: 6 - init_timestamp: ${{ env.INIT_TIMESTAMP }}