Files
firezone/.github/workflows/integration-tests.yml
Jamil d27da5ee3d Fix cache for Docker buildx (#1750)
~~This is an attempt to fix the CI bug
[here](https://github.com/firezone/firezone/actions/runs/5491388141/jobs/10007864417#step:4:1638)
possibly introduced in
[d9eb2d18](https://github.com/firezone/firezone/commit/d9eb2d18#diff-88bd94db0d5cfd5f0617b7c4ed48c0212597378ed7e28714c5d86c95999b4c7dR29)
and uncovered / exacerbated in Elixir 1.15~~

Edit: looks like this ended up being a couple cache issues with GitHub
actions:
1. The `elixir_api-container-build` cache would always overwrite the
`elixir_web-container-build` on subsequent builds of the same
`github.ref_name` (cache is scoped to branch name by default), leading
to the consistent error `Elixir.Web.Mailer.NoopAdapter does not exist`
whenever a branch was pushed to more than once.
2. The same thing happens with the `integration_test-basic-flow` job
because the `api` service gets built after the `web` service in
docker-compose.yml, overwriting its cache

For some reason it seems the `APPLICATION_NAME` ARG is not busting the
Docker cache properly on GitHub actions for elixir container builds, so
the fix here was to [use
`scope=`](https://docs.docker.com/build/cache/backends/gha/#scope) to
segregate the cache layers between builds of the same branch.
2023-07-10 17:30:09 +00:00

42 lines
1.7 KiB
YAML

name: Integration Tests
on:
merge_group:
types: [checks_requested]
pull_request:
workflow_dispatch:
jobs:
integration-test_basic-flow:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build images
uses: docker/bake-action@v3
with:
set: |
elixir.cache-from=scope=elixir,type=gha
elixir.cache-to=scope=elixir,type=gha,mode=max
api.cache-from=scope=api,type=gha
api.cache-to=scope=api,type=gha,mode=max
web.cache-from=scope=web,type=gha
web.cache-to=scope=web,type=gha,mode=max
files: docker-compose.yml
push: false
- name: Seed database
run: docker compose run elixir /bin/sh -c "cd apps/domain && mix ecto.seed"
- name: Start docker compose in the background
run: docker compose up -d
- name: Test that client can ping resource
# FIXME: When the client sends the first packet trying to connect but there's no relay
# the portal responds with that and we don't try to continue the flow until we receive a success
# response with all the relays, thus we just sleep here waiting for the relay to have its presence tracked
# by the portal.
# The fix next will be:
# * If the relay list comes back as an error, retry a few times
# * If the it still comes as an error try a direct connection(local network)
# Right now this is working because we wait for the relay to be up and running before starting the client
run: docker compose exec -it client ping 172.20.0.100 -c 5