Skip to content

chore: run e2e tests in github actions #39

chore: run e2e tests in github actions

chore: run e2e tests in github actions #39

Workflow file for this run

name: End to End Tests
on:
pull_request:
env:
TAR_PATH: docker-image.tar
ARTIFACT_NAME: tar-docker-image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-e2e-tests-and-build-binary:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: '^1.22'
- name: Download and unpack heighliner
run: |
curl -L -o heighliner.tar.gz https://github.com/strangelove-ventures/heighliner/releases/download/v1.5.4/heighliner_1.5.4_linux_amd64.tar.gz
tar -xzvf heighliner.tar.gz
- run: "heighliner build -c noble-forwarding-simd --local --tar-export-path ${{ env.TAR_PATH }}"
- name: Publish Tarball as Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.TAR_PATH }}
- name: Generate matrix
id: set-matrix
run: |
# Run the command and convert its output to a JSON array
TESTS=$(cd e2e && go test -list . | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${TESTS}" >> $GITHUB_OUTPUT
e2e-tests:
needs:
- prepare-e2e-tests-and-build-binary
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test: ${{fromJson(needs.prepare-e2e-tests-and-build-binary.matrix)}}
fail-fast: false
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: '^1.22'
- name: checkout chain
uses: actions/checkout@v4
- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
- name: Load Docker Image
run: docker image load -i ${{ env.TAR_PATH }}
- name: run test
run: cd e2e && go test -race -v -timeout 30m -run ^${{ matrix.test }}$ .