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

e687cc5 · Gabe Morell · 2026-10-27 02:45

6 files +94 -5
Message
{commit_body(@commit)}

Files changed

modified .forgejo/workflows/image.yml
+92 −5
@@ -6,19 +6,78 @@
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. The .github copies
11 +# of those jobs are skipped here, so they run once.
12 +name: ci (forge)
12 13
13 14 on:
14 15 push:
15 16 branches: [master]
16 17 tags: ['v*']
18 + pull_request:
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 + # Cap the test DB pool below the Postgres service's default
34 + # max_connections (100); big CI runners otherwise scale pool to cores×2
35 + # and exhaust connections.
36 + POOL_SIZE: "40"
37 + services:
38 + postgres:
39 + image: docker.io/postgres:16-alpine
40 + env:
41 + POSTGRES_USER: postgres
42 + POSTGRES_PASSWORD: postgres
43 + ports:
44 + - 5432:5432
45 + options: >-
46 + --health-cmd "pg_isready -U postgres"
47 + --health-interval 5s
48 + --health-timeout 3s
49 + --health-retries 5
50 + steps:
51 + - uses: actions/checkout@v4
52 +
53 + # ARC's default runner image is bare; install the toolchain needed to
54 + # compile native deps.
55 + - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends make build-essential
56 + # Forge fork of erlef/setup-beam: defaults ImageOS to ubuntu-24.04,
57 + # since forgejo/act injects an unmappable ImageOS from the runs-on label.
58 + - uses: https://gg.neiam.co/neiam/action-setup-beam@v1
59 + with:
60 + # Match the build image in the Dockerfile.
61 + elixir-version: "1.20.4"
62 + otp-version: "28.5.0.8"
63 +
64 + - uses: actions/cache@v4
65 + with:
66 + path: |
67 + deps
68 + _build
69 + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
70 + restore-keys: ${{ runner.os }}-mix-
71 +
72 + - run: mix deps.get
73 +
74 + # `mix precommit` = compile --warnings-as-errors, deps.unlock --unused,
75 + # format, test (which creates + migrates the test DB).
76 + - run: mix precommit
77 +
78 + image:
79 + needs: [test]
80 + if: github.server_url != 'https://github.com' && github.event_name != 'pull_request'
22 81 runs-on: arc-runner-set
23 82 permissions:
24 83 contents: read
@@ -36,10 +95,38 @@ jobs:
36 95 username: gitgud-actions
37 96 password: ${{ github.token }}
38 97
98 + # Public registries, off on the forge (GitHub pushes them). To push
99 + # from here too, uncomment these logins and the extra `images:` lines.
100 + # - name: Log in to GHCR
101 + # uses: docker/login-action@v3
102 + # with:
103 + # registry: ghcr.io
104 + # username: ${{ vars.GHCR_USER || github.actor }}
105 + # password: ${{ secrets.GHCR_TOKEN }}
106 + #
107 + # - name: Log in to Docker Hub
108 + # uses: docker/login-action@v3
109 + # with:
110 + # registry: docker.io
111 + # username: ${{ secrets.DOCKERHUB_USER }}
112 + # password: ${{ secrets.DOCKERHUB_TOKEN }}
113 + #
114 + # - name: Log in to Quay
115 + # uses: docker/login-action@v3
116 + # with:
117 + # registry: quay.io
118 + # username: ${{ secrets.QUAY_USERNAME }}
119 + # password: ${{ secrets.QUAY_TOKEN }}
120 +
39 121 - id: meta
40 122 uses: docker/metadata-action@v5
41 123 with:
42 − images: ${{ vars.CI_REGISTRY }}/${{ github.repository }}
124 + # metadata-action skips '#' lines in its inputs.
125 + images: |
126 + ${{ vars.CI_REGISTRY }}/${{ github.repository }}
127 + # ghcr.io/${{ github.repository }}
128 + # docker.io/neiam/feedpug
129 + # quay.io/neiam/feedpug
43 130 tags: |
44 131 type=ref,event=branch
45 132 type=semver,pattern={{version}}
modified .github/workflows/ci.yml
+2 −0
@@ -7,7 +7,9 @@ on:
7 7 pull_request:
8 8
9 9 jobs:
10 + # GitHub only; the forge runs its copy in .forgejo/workflows/image.yml.
10 11 test:
12 + if: github.server_url == 'https://github.com'
11 13 # Self-hosted ARC runners (same as ../angler). Swap for `ubuntu-latest`
12 14 # if you'd rather use GitHub-hosted runners. The Postgres service container
13 15 # requires the runner to support service containers (Docker/dind).

Parents: 37afa2b