From 1307a068f687fc4529468fa91a9b540dd5b860b3 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:38:33 +0000 Subject: [PATCH 01/10] feat: enabling e2e tests --- .github/workflows/test-e2e.yaml | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/test-e2e.yaml diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml new file mode 100644 index 000000000..8b84586ab --- /dev/null +++ b/.github/workflows/test-e2e.yaml @@ -0,0 +1,81 @@ +name: E2E Tests + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build-docker-image: + name: Build Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and export + uses: docker/build-push-action@v5 + with: + context: . + tags: vechain/thor:${{ github.sha }} + outputs: type=docker,dest=/tmp/vechain-thor.tar + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: vechain-thor-image + path: /tmp/vechain-thor.tar + retention-days: 7 + + run-tests: + runs-on: ubuntu-latest + needs: build-docker-image + env: + THOR_IMAGE: vechain/thor:${{ github.sha }} + name: Run E2E Tests + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + repository: vechain/thor-e2e-tests + # TODO: Should we use tags here? eg 'v2.1.0' + ref: main + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: vechain-thor-image + path: /tmp + + - name: Setup Node JS + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Load image + run: | + docker load --input /tmp/vechain-thor.tar + docker image ls -a + + - name: Run Tests + working-directory: ./tests/thor-e2e-tests + run: | + export THOR_IMAGE=vechain/thor:${{ github.sha }} + yarn install + yarn test + + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: e2e-test-results + path: ./tests/thor-e2e-tests/junit.xml From 88b69694393bf4d1ebb6e6512de9e49e06fda958 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:39:43 +0000 Subject: [PATCH 02/10] fix: trigger from workflow call --- .github/workflows/on-master-commit.yaml | 5 +++++ .github/workflows/on-pull-request.yaml | 4 ++++ .github/workflows/test-e2e.yaml | 7 +------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/on-master-commit.yaml b/.github/workflows/on-master-commit.yaml index 2770b6350..a984c7a11 100644 --- a/.github/workflows/on-master-commit.yaml +++ b/.github/workflows/on-master-commit.yaml @@ -14,6 +14,10 @@ jobs: name: Lint uses: ./.github/workflows/lint-go.yaml + run-e2e-tests: + name: Run E2E Tests + uses: ./.github/workflows/test-e2e.yaml + generate-tags: name: Generate Docker Tags runs-on: ubuntu-latest @@ -34,6 +38,7 @@ jobs: secrets: inherit needs: - run-unit-tests + - run-e2e-tests - generate-tags - lint permissions: diff --git a/.github/workflows/on-pull-request.yaml b/.github/workflows/on-pull-request.yaml index 143d08bdf..5fd407d14 100644 --- a/.github/workflows/on-pull-request.yaml +++ b/.github/workflows/on-pull-request.yaml @@ -10,6 +10,10 @@ jobs: name: Run Unit Tests uses: ./.github/workflows/test.yaml + run-e2e-tests: + name: Run E2E Tests + uses: ./.github/workflows/test-e2e.yaml + lint: name: Lint uses: ./.github/workflows/lint-go.yaml diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 8b84586ab..817344e9d 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -1,12 +1,7 @@ name: E2E Tests on: - pull_request: - branches: - - master - push: - branches: - - master + workflow_call: jobs: build-docker-image: From 2a87a34b277b40f3bd05f050750d35f9236c7b3f Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:41:19 +0000 Subject: [PATCH 03/10] chore: update actions names --- .github/workflows/on-master-commit.yaml | 2 +- .github/workflows/on-pull-request.yaml | 2 +- .github/workflows/test-e2e.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on-master-commit.yaml b/.github/workflows/on-master-commit.yaml index a984c7a11..9a51890f6 100644 --- a/.github/workflows/on-master-commit.yaml +++ b/.github/workflows/on-master-commit.yaml @@ -15,7 +15,7 @@ jobs: uses: ./.github/workflows/lint-go.yaml run-e2e-tests: - name: Run E2E Tests + name: E2E Tests uses: ./.github/workflows/test-e2e.yaml generate-tags: diff --git a/.github/workflows/on-pull-request.yaml b/.github/workflows/on-pull-request.yaml index 5fd407d14..5ddf8cb92 100644 --- a/.github/workflows/on-pull-request.yaml +++ b/.github/workflows/on-pull-request.yaml @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/test.yaml run-e2e-tests: - name: Run E2E Tests + name: E2E Tests uses: ./.github/workflows/test-e2e.yaml lint: diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 817344e9d..08fa4a053 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -36,7 +36,7 @@ jobs: needs: build-docker-image env: THOR_IMAGE: vechain/thor:${{ github.sha }} - name: Run E2E Tests + name: Run Tests steps: - name: Checkout From 29f8813abe3c44984e76443f23e80355673865dc Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:43:11 +0000 Subject: [PATCH 04/10] fix: thor tests path --- .github/workflows/test-e2e.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 08fa4a053..9eaf659bb 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -63,7 +63,6 @@ jobs: docker image ls -a - name: Run Tests - working-directory: ./tests/thor-e2e-tests run: | export THOR_IMAGE=vechain/thor:${{ github.sha }} yarn install From e4fb4c99262ad36312237b42a2946b39c65316e4 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:44:37 +0000 Subject: [PATCH 05/10] feat: cancel old runs --- .github/workflows/on-pull-request.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/on-pull-request.yaml b/.github/workflows/on-pull-request.yaml index 5ddf8cb92..b39edbd57 100644 --- a/.github/workflows/on-pull-request.yaml +++ b/.github/workflows/on-pull-request.yaml @@ -5,6 +5,10 @@ on: branches: - master +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: run-unit-tests: name: Run Unit Tests From d901af9d6cbff9962816b8d09a164a89bb1ec63e Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:47:01 +0000 Subject: [PATCH 06/10] fix: update junit.xml path --- .github/workflows/test-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 9eaf659bb..2141f295b 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -72,4 +72,4 @@ jobs: if: success() || failure() with: name: e2e-test-results - path: ./tests/thor-e2e-tests/junit.xml + path: ./junit.xml From 18b8248d77d95ad7faf3c2f919c53f5b9a132b47 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:52:56 +0000 Subject: [PATCH 07/10] fix: update upload artifact --- .github/workflows/test-e2e.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 2141f295b..73a790634 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -68,8 +68,9 @@ jobs: yarn install yarn test - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: success() || failure() with: - name: e2e-test-results + name: e2e-test-results-${{ github.sha }} path: ./junit.xml + retention-days: 14 From c590a7bbd95446529c9cf6e004a3c0e8bc68f6ae Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Mar 2024 12:55:37 +0000 Subject: [PATCH 08/10] fix: use sha docker docker artifact --- .github/workflows/test-e2e.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index 73a790634..d0eb610f0 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -25,9 +25,9 @@ jobs: outputs: type=docker,dest=/tmp/vechain-thor.tar - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: vechain-thor-image + name: vechain-thor-image-${{ github.sha }} path: /tmp/vechain-thor.tar retention-days: 7 @@ -47,9 +47,9 @@ jobs: ref: main - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: vechain-thor-image + name: vechain-thor-image-${{ github.sha }} path: /tmp - name: Setup Node JS From 9de05fc8bb227d8e2da2acea4f9d13e6e36e0cc5 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Tue, 2 Apr 2024 10:21:21 +0100 Subject: [PATCH 09/10] chore: use specific tag --- .github/workflows/test-e2e.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index d0eb610f0..ad6e182dd 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -43,8 +43,8 @@ jobs: uses: actions/checkout@v4 with: repository: vechain/thor-e2e-tests - # TODO: Should we use tags here? eg 'v2.1.0' - ref: main + # https://github.com/vechain/thor-e2e-tests/tree/2cb22d804bb3cdf075917dbece42a182d42d7486 + ref: 2cb22d8 - name: Download artifact uses: actions/download-artifact@v4 From ce0ee6b6849db08f0e1f7dfd6a312694dc2d8732 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Wed, 3 Apr 2024 18:10:07 +0100 Subject: [PATCH 10/10] fix: use full sha for ref --- .github/workflows/test-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index ad6e182dd..e0b3eaf31 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -44,7 +44,7 @@ jobs: with: repository: vechain/thor-e2e-tests # https://github.com/vechain/thor-e2e-tests/tree/2cb22d804bb3cdf075917dbece42a182d42d7486 - ref: 2cb22d8 + ref: 2cb22d804bb3cdf075917dbece42a182d42d7486 - name: Download artifact uses: actions/download-artifact@v4