CI: tests on the forge too; public registries kept, commented

063e886 · Gabe Morell · 2026-10-27 02:45

3 files +97 -5
Message
{commit_body(@commit)}

Files changed

modified .forgejo/workflows/image.yml
+97 −5
@@ -6,9 +6,11 @@
6 6 # No secrets. The forge injects CI_REGISTRY and accepts the per-job
7 7 # github.token for push to this repository's own image path.
8 8 #
9 −# No test gate: this workflow can't `needs:` ci.yml's test job (mix precommit),
10 −# and the Dockerfile compiles the release itself.
11 −name: image
9 +# Tests gate the image, as on GitHub: ci.yml's test job (mix precommit) is
10 +# copied in above the image job, guarded to the forge. ci.yml's test job
11 +# still runs here too: its android job needs it, so this copy is a
12 +# deliberate duplicate.
13 +name: ci (forge)
12 14
13 15 on:
14 16 push:
@@ -17,8 +19,70 @@ on:
17 19 workflow_dispatch:
18 20
19 21 jobs:
20 − image:
22 + test:
21 23 if: github.server_url != 'https://github.com'
24 + # Self-hosted ARC runners (same as ../angler). Swap for `ubuntu-latest`
25 + # if you'd rather use GitHub-hosted runners. The Postgres service container
26 + # requires the runner to support service containers (Docker/dind).
27 + runs-on: arc-runner-set
28 + env:
29 + MIX_ENV: test
30 + # Under forgejo-runner/act the job runs in a container, so the postgres
31 + # service is reached by its service name, not localhost.
32 + POSTGRES_HOST: postgres
33 + # service is reached at its container port under forgejo-runner
34 + POSTGRES_PORT: 5432
35 + # Cap the test DB pool below the Postgres service's default
36 + # max_connections (100); big CI runners otherwise scale pool to cores×2
37 + # and exhaust connections.
38 + POOL_SIZE: "40"
39 + services:
40 + postgres:
41 + image: docker.io/postgres:16-alpine
42 + env:
43 + POSTGRES_USER: postgres
44 + POSTGRES_PASSWORD: postgres
45 + # config/test.exs connects on 54329 (matches compose.yml), so publish
46 + # the service container's 5432 on that host port.
47 + ports:
48 + - 54329:5432
49 + options: >-
50 + --health-cmd "pg_isready -U postgres"
51 + --health-interval 5s
52 + --health-timeout 3s
53 + --health-retries 5
54 + steps:
55 + - uses: actions/checkout@v4
56 +
57 + # ARC's default runner image is bare; install the toolchain needed to
58 + # compile native deps.
59 + - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends make build-essential
60 + # Forge fork of erlef/setup-beam: defaults ImageOS to ubuntu-24.04,
61 + # since forgejo/act injects an unmappable ImageOS from the runs-on label.
62 + - uses: https://gg.neiam.co/neiam/action-setup-beam@v1
63 + with:
64 + # Match the build image in the Dockerfile (OTP >= 27.3.3; 27.2 breaks
65 + # `mix local.hex` against hex.pm's current TLS chain).
66 + elixir-version: "1.20.4"
67 + otp-version: "28.5.0.8"
68 +
69 + - uses: actions/cache@v4
70 + with:
71 + path: |
72 + deps
73 + _build
74 + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
75 + restore-keys: ${{ runner.os }}-mix-
76 +
77 + - run: mix deps.get
78 +
79 + # `mix precommit` = compile --warnings-as-errors, deps.unlock --unused,
80 + # format, test (which creates + migrates the test DB).
81 + - run: mix precommit
82 +
83 + image:
84 + needs: [test]
85 + if: github.server_url != 'https://github.com' && github.event_name != 'pull_request'
22 86 runs-on: arc-runner-set
23 87 permissions:
24 88 contents: read
@@ -36,10 +100,38 @@ jobs:
36 100 username: gitgud-actions
37 101 password: ${{ github.token }}
38 102
103 + # Public registries, off on the forge (GitHub pushes them). To push
104 + # from here too, uncomment these logins and the extra `images:` lines.
105 + # - name: Log in to GHCR
106 + # uses: docker/login-action@v3
107 + # with:
108 + # registry: ghcr.io
109 + # username: ${{ vars.GHCR_USER || github.actor }}
110 + # password: ${{ secrets.GHCR_TOKEN }}
111 + #
112 + # - name: Log in to Docker Hub
113 + # uses: docker/login-action@v3
114 + # with:
115 + # registry: docker.io
116 + # username: ${{ secrets.DOCKERHUB_USER }}
117 + # password: ${{ secrets.DOCKERHUB_TOKEN }}
118 + #
119 + # - name: Log in to Quay
120 + # uses: docker/login-action@v3
121 + # with:
122 + # registry: quay.io
123 + # username: ${{ secrets.QUAY_USERNAME }}
124 + # password: ${{ secrets.QUAY_TOKEN }}
125 +
39 126 - id: meta
40 127 uses: docker/metadata-action@v5
41 128 with:
42 − images: ${{ vars.CI_REGISTRY }}/${{ github.repository }}
129 + # metadata-action skips '#' lines in its inputs.
130 + images: |
131 + ${{ vars.CI_REGISTRY }}/${{ github.repository }}
132 + # ghcr.io/${{ github.repository }}
133 + # docker.io/neiam/diogramos
134 + # quay.io/neiam/diogramos
43 135 tags: |
44 136 type=ref,event=branch
45 137 type=semver,pattern={{version}}

Parents: 7005ebf