note the nektos/act vs gitea act_runner network issue
Some checks failed
ci / build (push) Has been cancelled
ci / Tests & Checks (push) Failing after 2m22s

This commit is contained in:
CJ_Clippy 2025-02-20 17:44:35 -08:00
parent 022b6010b2
commit 5fcf4c5233
2 changed files with 40 additions and 18 deletions

View File

@ -9,6 +9,17 @@ on:
- cron: "6 */12 * * *" - cron: "6 */12 * * *"
jobs: jobs:
# there is some undesirable behavior when running tests because nektos/act mimicks github actions.
# we are banned from github so we aren't using that. instead, we use gitea act_runner.
# github actions Job runner runs on docker 'host' network.
# gitea act_runner runs on a custom named bridge network. e.g. `GITEA-ACTIONS-TASK-974_WORKFLOW-ci_JOB-Tests-Checks-test_phoenix-network`
# confusing, right? It totally is!
# when we are working with gitea act_runner, we can use dns names, e.g. test-db.
# when we are working with nektos/act, we must use the IP address of the service container.
# this causes issues because nektos/act will not be able to find test-db:5432 but act_runner can.
# this means we have inconsistent behavior across testing environments, which is bad.
# our workaround is to use localhost on local dev, and the dns name on gitea act_runner.
test_phoenix: test_phoenix:
env: env:
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
@ -37,14 +48,15 @@ jobs:
pull-requests: write pull-requests: write
services: services:
db: test-db:
image: postgres:16 image: postgres:16
ports:
- 5433:5432
env: env:
POSTGRES_DB: ${{ vars.DB_NAME }} POSTGRES_DB: ${{ vars.DB_NAME }}
POSTGRES_USER: ${{ vars.DB_USER }} POSTGRES_USER: ${{ vars.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASS }} POSTGRES_PASSWORD: ${{ secrets.DB_PASS }}
PGUSER: ${{ vars.DB_USER }}
ports:
- 5433:5432
options: >- options: >-
--health-cmd pg_isready --health-cmd pg_isready
--health-interval 10s --health-interval 10s
@ -98,6 +110,14 @@ jobs:
user = "nobody" user = "nobody"
steps: steps:
# I wasn't successful with this. Something about the docker network in which the container runs?
# - name: postgres service check
# env:
# PGPASSWORD: ${{ secrets.DB_PASS }}
# uses: docker://postgres:16
# with:
# args: /usr/bin/pg_isready --host test-db --port 5432
- name: Setup FFmpeg - name: Setup FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3 uses: FedericoCarboni/setup-ffmpeg@v3
@ -122,14 +142,14 @@ jobs:
elixir-version: "1.16.0-otp-26" elixir-version: "1.16.0-otp-26"
otp-version: "26.0" otp-version: "26.0"
- name: Mix and build cache # - name: Mix and build cache
uses: actions/cache@v4 # uses: actions/cache@v4
with: # with:
path: | # path: |
deps # deps
_build # _build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} # key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix- # restore-keys: ${{ runner.os }}-mix-
- name: Get dependencies - name: Get dependencies
run: mix deps.get run: mix deps.get

View File

@ -41,11 +41,13 @@ Use devbox helper script
cat ./backups/your-backup.sql | docker exec -i postgres_db psql -U postgres cat ./backups/your-backup.sql | docker exec -i postgres_db psql -U postgres
## Metrics Notes ## testing
Keeping track of metrics we want to scrape using Prometheus
there is some undesirable behavior when running tests because nektos/act mimicks github actions.
we are banned from github so we aren't using that. instead, we use gitea act_runner.
github actions Job runner runs on docker 'host' network.
gitea act_runner runs on a custom named bridge network. e.g. `GITEA-ACTIONS-TASK-974_WORKFLOW-ci_JOB-Tests-Checks-test_phoenix-network`
confusing, right? It totally is!
when we are working with gitea act_runner, we can use dns names, e.g. test-db.
when we are working with nektos/act, we must use the IP address of the service container.
WTF there must be a better way