Skip to content

Commit

Permalink
Migrates to GH action matrix for E2E runs, preferring actions-setup-d…
Browse files Browse the repository at this point in the history
…ocker

This moves special-casing to rust+macOS cell in a normal build matrix.
Issue #152 still needs investigation on how to get around the slowness.

Fixes #153
Fixes #145

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
Adrian Cole committed Apr 2, 2021
1 parent d1ce5a3 commit 1d75cac
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 172 deletions.
70 changes: 26 additions & 44 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,30 @@ jobs:
name: bin
path: build/bin

e2e_linux:
name: "Run e2e tests on Linux"
e2e:
name: "Run end-to-end (e2e) tests"
needs:
- bin
runs-on: ubuntu-latest
timeout-minutes: 30 # instead of 360 by default
runs-on: ${{ matrix.os }}
timeout-minutes: 90 # instead of 360 by default
strategy:
matrix:
include: # Controls language used in all extension tests. Managed by test/e2e/main_test.go
include:
- extension-language: rust
os: macOS-latest
- extension-language: rust
os: ubuntu-latest
# Attempt to avoid re-downloading almost 200MB of deps per test that implies "getenvoy extension build"
# This uses the runner.temp variable directly to avoid having to mkdir a sub-path. Don't use this on macOS
# as writes to a bind mount are extremely slow.
toolchain-container-options: "-v ${{ runner.temp }}:/tmp/cargohome -e CARGO_HOME=/tmp/cargohome"
- extension-language: tinygo
os: macOS-latest
- extension-language: tinygo
os: ubuntu-latest
env:
E2E_EXTENSION_LANGUAGE: ${{ matrix.extension-language }}
E2E_TOOLCHAIN_CONTAINER_OPTIONS: ${{ matrix.toolchain-container-options }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -65,50 +76,21 @@ jobs:
name: bin
path: build/bin

- name: "Build language-specific Docker build images"
run: make builders

- name: "Run e2e tests using the `getenvoy` binary built by the upstream job"
run: | # chmod to restore permissions lost in actions/download-artifact@v2
chmod a+x build/bin/linux/amd64/getenvoy
./ci/e2e/linux/run_tests.sh
e2e_macos:
name: "Run e2e tests on MacOS"
needs:
- bin
runs-on: macos-latest
timeout-minutes: 90 # instead of 360 by default
strategy:
matrix:
include: # Controls language used in all extension tests. Managed by test/e2e/main_test.go
- extension-language: rust
- extension-language: tinygo
env:
E2E_EXTENSION_LANGUAGE: ${{ matrix.extension-language }}
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Re-use the `getenvoy` binary pre-built by the upstream job"
uses: actions/download-artifact@v2
- name: "Install Latest 'Docker for Mac'"
uses: docker-practice/actions-setup-docker@v1
if: runner.os == 'macOS' && matrix.extension-language == 'tinygo'
with:
name: bin
path: build/bin
docker_buildx: false # Install is flakey. When it, we can install it via docker/setup-buildx-action@v1
timeout-minutes: 20 # fail fast if MacOS install takes too long

- name: "Install 'Docker for Mac' (an older version that can be installed in CI environment)"
- name: "Install Old 'Docker for Mac'" # locked until #152 is fixed
if: runner.os == 'macOS' && matrix.extension-language == 'rust'
run: ./ci/e2e/darwin/install_docker.sh
timeout-minutes: 7 # unfortunately, installing `Docker for Mac` in CI environment is fragile; be ready to restart the job occasionally
timeout-minutes: 20 # fail fast if MacOS install takes too long

- name: "Build language-specific Docker build images"
env:
# don't use `DOCKER_BUILDKIT=1`, `--build-arg BUILDKIT_INLINE_CACHE=1` and `--cache-from`
# options when using `Docker for Mac` in CI environment
USE_DOCKER_BUILDKIT_CACHE: 'no'
run: make builders
timeout-minutes: 10 # fail fast if MacOS runner becomes to slow
timeout-minutes: 10 # fail fast if MacOS runner becomes too slow

- name: "Run e2e tests using the `getenvoy` binary built by the upstream job"
run: | # chmod to restore permissions lost in actions/download-artifact@v2
chmod a+x build/bin/darwin/amd64/getenvoy
./ci/e2e/darwin/run_tests.sh
run: make e2e
92 changes: 30 additions & 62 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,31 @@ jobs:
- name: "Push extension builder images"
run: make builders.push BUILDERS_TAG=${{ env.RELEASE_VERSION }}

e2e_linux:
name: "Run e2e tests on Linux"
e2e:
name: "Run end-to-end (e2e) tests"
needs:
- getenvoy
- builders
runs-on: ubuntu-latest
timeout-minutes: 30 # instead of 360 by default
runs-on: ${{ matrix.os }}
timeout-minutes: 90 # instead of 360 by default
strategy:
matrix:
include: # Controls language used in all extension tests. Managed by test/e2e/main_test.go
include:
- extension-language: rust
os: macOS-latest
- extension-language: rust
os: ubuntu-latest
# Attempt to avoid re-downloading almost 200MB of deps per test that implies "getenvoy extension build"
# This uses the runner.temp variable directly to avoid having to mkdir a sub-path. Don't use this on macOS
# as writes to a bind mount are extremely slow.
toolchain-container-options: "-v ${{ runner.temp }}:/tmp/cargohome -e CARGO_HOME=/tmp/cargohome"
- extension-language: tinygo
os: macOS-latest
- extension-language: tinygo
os: ubuntu-latest
env:
E2E_EXTENSION_LANGUAGE: ${{ matrix.extension-language }}
E2E_TOOLCHAIN_CONTAINER_OPTIONS: ${{ matrix.toolchain-container-options }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -95,72 +106,29 @@ jobs:
if [[ "${RELEASE_TAG}" = v* ]]; then RELEASE_VERSION="${RELEASE_TAG:1}"; else RELEASE_VERSION="${RELEASE_TAG}"; fi
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
- name: "Download `e2e` binary pre-built by the upstream job"
uses: actions/download-artifact@v2
with:
name: bin
path: build/bin
echo "OS_NAME=$(uname -s)" >> $GITHUB_ENV
- name: "Download `getenvoy` binary from GitHub release assets"
env:
INPUT_FILE: getenvoy_${{ env.RELEASE_VERSION }}_Linux_x86_64.tar.gz
INPUT_FILE: getenvoy_${{ env.RELEASE_VERSION }}_${{ env.OS_NAME }}_x86_64.tar.gz
INPUT_VERSION: tags/${{ env.RELEASE_TAG }}
run: | # extract getenvoy to location used in `make e2e`. don't chmod because tar.gz should be correct.
curl -s https://raw.githubusercontent.com/dsaltares/fetch-gh-release-asset/0.0.5/fetch_github_asset.sh | bash
mkdir -p build/bin/linux/amd64
tar -C build/bin/linux/amd64 -xf ${INPUT_FILE} getenvoy
GOOS=$(uname -s|tr '[:upper:]' '[:lower:]')
mkdir -p build/bin/${GOOS}/amd64
tar -C build/bin/${GOOS}/amd64 -xf ${INPUT_FILE} getenvoy
- name: "Pull extension builder images"
# pull Docker images in advance to make output of `getenvoy extension build | test | run` stable
run: make builders.pull BUILDERS_TAG=${{ env.RELEASE_VERSION }}

- name: "Run e2e tests using released `getenvoy` binary and published extension builder images"
run: ./ci/e2e/linux/run_tests.sh

e2e_macos:
name: "Run e2e tests on MacOS"
needs:
- getenvoy
- builders
runs-on: macos-latest
timeout-minutes: 90 # instead of 360 by default
strategy:
matrix:
include: # Controls language used in all extension tests. Managed by test/e2e/main_test.go
- extension-language: rust
- extension-language: tinygo
env:
E2E_EXTENSION_LANGUAGE: ${{ matrix.extension-language }}
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Get tag name"
run: | # Trim "v" prefix in the release tag
RELEASE_TAG=${GITHUB_REF#refs/*/}
if [[ "${RELEASE_TAG}" = v* ]]; then RELEASE_VERSION="${RELEASE_TAG:1}"; else RELEASE_VERSION="${RELEASE_TAG}"; fi
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
- name: "Download `e2e` binary pre-built by the upstream job"
uses: actions/download-artifact@v2
- name: "Install Latest 'Docker for Mac'"
uses: docker-practice/actions-setup-docker@v1
if: runner.os == 'macOS' && matrix.extension-language == 'tinygo'
with:
name: bin
path: build/bin

- name: "Download `getenvoy` binary from GitHub release assets"
env:
INPUT_FILE: getenvoy_${{ env.RELEASE_VERSION }}_Darwin_x86_64.tar.gz
INPUT_VERSION: tags/${{ env.RELEASE_TAG }}
run: | # extract getenvoy to location used in `make e2e`. don't chmod because tar.gz should be correct.
curl -s https://raw.githubusercontent.com/dsaltares/fetch-gh-release-asset/0.0.5/fetch_github_asset.sh | bash
mkdir -p build/bin/darwin/amd64
tar -C build/bin/darwin/amd64 -xf ${INPUT_FILE} getenvoy
docker_buildx: false # Install is flakey. When it, we can install it via docker/setup-buildx-action@v1
timeout-minutes: 20 # fail fast if MacOS install takes too long

- name: "Install 'Docker for Mac' (an older version that can be installed in CI environment)"
- name: "Install Old 'Docker for Mac'" # locked until #152 is fixed
if: runner.os == 'macOS' && matrix.extension-language == 'rust'
run: ./ci/e2e/darwin/install_docker.sh
timeout-minutes: 7 # unfortunately, installing `Docker for Mac` in CI environment is fragile; be ready to restart the job ocasionally
timeout-minutes: 20 # fail fast if MacOS install takes too long

- name: "Pull extension builder images"
# pull Docker images in advance to make output of
Expand All @@ -169,4 +137,4 @@ jobs:
timeout-minutes: 10 # fail fast if MacOS runner becomes to slow

- name: "Run e2e tests using released `getenvoy` binary and published extension builder images"
run: ./ci/e2e/darwin/run_tests.sh
run: make e2e
34 changes: 0 additions & 34 deletions ci/e2e/darwin/run_tests.sh

This file was deleted.

32 changes: 0 additions & 32 deletions ci/e2e/linux/run_tests.sh

This file was deleted.

0 comments on commit 1d75cac

Please sign in to comment.