Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting e2e tests into two separate workflows #1719

Merged
merged 6 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a fork-only workflow that will build and run the test locally to the host. There is no interaction with our ghcr registries.

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything in this file was just moved from test.yml. The only change is the addition of the if statements.

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 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't be able to verify this until the PR is merged unfortunately. I'll keep an eye on the action and create a fix if there are any issues.

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 }}