Skip to content

Commit

Permalink
Split e2e workflow in 2 in order to run the 03 tests with a matrix fo…
Browse files Browse the repository at this point in the history
…r SQLite and PG.
  • Loading branch information
kevin-dp committed Apr 30, 2024
1 parent fbbf236 commit f99639d
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
# Root files
- "*"
- "!pnpm-lock.yaml"
- "!clients/typescript/**" # Satellite tests run in a separate workflow
# CI files not related to GH actions
- ".buildkite/**"
- "**/README.md"
Expand Down Expand Up @@ -80,7 +81,7 @@ jobs:

- run: make lux
- run: make deps pull
- run: make test_sqlite_and_pg
- run: make test-no-satellite
id: tests
env:
ELECTRIC_IMAGE_NAME: electric-sql-ci/electric
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/e2e_satellite_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: E2E / Satellite
on:
push:
branches:
- main
pull_request:
paths-ignore:
# Root files
- "*"
- "!pnpm-lock.yaml"
# CI files not related to GH actions
- ".buildkite/**"
- "**/README.md"
- "docs/**"

env:
OTP_VERSION: "25.3.2.8"
ELIXIR_VERSION: "1.16.1-otp-25"

concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e_tests:
name: E2E tests
runs-on: electric-e2e-8-32
strategy:
matrix:
dialect: [SQLite, Postgres]
defaults:
run:
working-directory: e2e
env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_TEST_ANALYTICS_E2E }}
DIALECT: ${{ matrix.dialect }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Inject variables for `docker buildx` github actions caching
uses: crazy-max/ghaction-github-runtime@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}

- run: |
echo "ELECTRIC_VERSION=$(make --silent print_version_from_git)" >> $GITHUB_ENV
working-directory: components/electric
- run: make docker-build-ci
env:
ELECTRIC_IMAGE_NAME: electric-sql-ci/electric
working-directory: components/electric
- run: make docker-build-ws-client
env:
ELECTRIC_CLIENT_IMAGE_NAME: electric-sql-ci/electric-ws-client
working-directory: components/electric

- name: Cache built lux
uses: actions/cache@v3
with:
path: |
e2e/lux/bin
e2e/lux/ebin
e2e/lux/priv
key: ${{ runner.os }}-luxbuilt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}

- run: make lux
- run: make deps pull
- run: make test-satellite-only
id: tests
env:
ELECTRIC_IMAGE_NAME: electric-sql-ci/electric
ELECTRIC_CLIENT_IMAGE_NAME: electric-sql-ci/electric-ws-client
ELECTRIC_IMAGE_TAG: ${{ env.ELECTRIC_VERSION }}

- name: Upload lux logs
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.tests.outcome == 'failure' }}
with:
name: lux_logs
path: e2e/**/lux_logs/run_*
- name: Upload test results to Buildkite analytics
if: ${{ !cancelled() && steps.tests.outcome != 'skipped' && env.BUILDKITE_ANALYTICS_TOKEN != '' }}
working-directory: e2e/lux_logs/latest_run
run: |
curl \
-X POST \
--fail-with-body \
-H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \
-F "data=@lux_junit.xml" \
-F "format=junit" \
-F "run_env[CI]=github_actions" \
-F "run_env[key]=$GITHUB_ACTION-$GITHUB_RUN_NUMBER-$GITHUB_RUN_ATTEMPT" \
-F "run_env[number]=$GITHUB_RUN_NUMBER" \
-F "run_env[branch]=$GITHUB_REF" \
-F "run_env[commit_sha]=$GITHUB_SHA" \
-F "run_env[url]=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
https://analytics-api.buildkite.com/v1/uploads
6 changes: 6 additions & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ test_only:

test: deps pull test_only

test-no-satellite:
find tests -type f -maxdepth 1 -name "*.lux" -and -not -name "03.*.lux" | sort -h | xargs ${LUX} --junit

test-satellite-only:
${LUX} --junit tests/03.*.lux

pull:
docker compose -f services_templates.yaml pull \
postgresql
Expand Down

0 comments on commit f99639d

Please sign in to comment.