Skip to content

Commit

Permalink
Extracting e2e tests into two separate workflows (#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Jul 18, 2022
1 parent 95cd1c5 commit 74ed532
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 91 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Tests / E2E Fork
on:
pull_request:
branches:
- main
paths-ignore:
- docs/**
jobs:
# dynamically build a matrix of test/test suite pairs to run
build-test-matrix:
if: ${{ github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: set-matrix
run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)"

e2e:
env:
SIMD_TAG: latest
SIMD_IMAGE: ibc-go-simd-e2e
if: ${{ github.event.pull_request.head.repo.fork }}
needs:
- build-test-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Docker Build
run: docker build . -t "${SIMD_IMAGE}:${SIMD_TAG}"
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Run e2e Test
run: |
cd e2e
make e2e-test suite=${{ matrix.suite }} test=${{ matrix.test }}
102 changes: 102 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Tests / E2E
on:
pull_request:
push:
branches:
- main
paths-ignore:
- docs/**

env:
REGISTRY: ghcr.io
IMAGE_NAME: ibc-go-simd-e2e

jobs:
docker-build:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# dynamically build a matrix of test/test suite pairs to run
build-test-matrix:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: set-matrix
run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)"


# the tag of the image will differ if this is a PR or the branch is being merged into main.
# we store the tag as an environment variable and use it in the E2E tests to determine the tag.
determine-image-tag:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
outputs:
simd-tag: ${{ steps.get-tag.outputs.simd-tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: get-tag
run: |
tag=$(go run .github/scripts/determine_simd_tag.go -pr "${{ github.event.pull_request.number }}" )
echo "Using tag $tag"
echo "::set-output name=simd-tag::$tag"
e2e:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
needs:
- build-test-matrix
- determine-image-tag
- docker-build
env:
SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }}
SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run e2e Test
run: |
cd e2e
make e2e-test suite=${{ matrix.suite }} test=${{ matrix.test }}
91 changes: 0 additions & 91 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ibc-go-simd-e2e

jobs:
cleanup-runs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -159,90 +155,3 @@ jobs:
with:
file: ./coverage.txt
if: env.GIT_DIFF


docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# dynamically build a matrix of test/test suite pairs to run
build-test-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: set-matrix
run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)"


# the tag of the image will differ if this is a PR or the branch is being merged into main.
# we store the tag as an environment variable and use it in the E2E tests to determine the tag.
determine-image-tag:
runs-on: ubuntu-latest
outputs:
simd-tag: ${{ steps.get-tag.outputs.simd-tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: get-tag
run: |
tag=$(go run .github/scripts/determine_simd_tag.go -pr "${{ github.event.pull_request.number }}" )
echo "Using tag $tag"
echo "::set-output name=simd-tag::$tag"
e2e:
runs-on: ubuntu-latest
needs:
- build-test-matrix
- determine-image-tag
- docker-build
env:
SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }}
SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run e2e Test
run: |
cd e2e
make e2e-test suite=${{ matrix.suite }} test=${{ matrix.test }}

0 comments on commit 74ed532

Please sign in to comment.