# The forge's copy of the image publish. .github/workflows/ci.yml's
# image job pushes to ghcr.io (and the other public registries), but only
# when it runs on GitHub; here the image goes to the forge's bundled
# registry (CI_REGISTRY), as camerite and gitgud do: <registry>/<owner>/<repo>.
#
# No secrets. The forge injects CI_REGISTRY and accepts the per-job
# github.token for push to this repository's own image path.
#
# Tests gate the image, as on GitHub: ci.yml's test job (mix precommit) is
# copied in above the image job, guarded to the forge. The .github copies
# of those jobs are skipped here, so they run once.
name: ci (forge)
on:
push:
branches: [master]
tags: ['v*']
pull_request:
workflow_dispatch:
# A newer push supersedes this run: on a branch or PR the run in
# progress is cancelled; on master it finishes, and only a run still
# waiting is replaced.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
test:
if: github.server_url != 'https://github.com'
# Self-hosted ARC runners (same as ../angler). Swap for `ubuntu-latest`
# if you'd rather use GitHub-hosted runners. The Postgres service container
# requires the runner to support service containers (Docker/dind).
runs-on: arc-runner-set
env:
MIX_ENV: test
# Under forgejo-runner/act the job runs in a container, so the postgres
# service is reached by its service name, not localhost.
POSTGRES_HOST: postgres
# service is reached at its container port under forgejo-runner
POSTGRES_PORT: 5432
# Cap the test DB pool below the Postgres service's default
# max_connections (100); big CI runners otherwise scale pool to cores×2
# and exhaust connections.
POOL_SIZE: "40"
services:
postgres:
image: docker.io/postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# config/test.exs connects on 54328 (matches compose.yml), so publish
# the service container's 5432 on that host port.
ports:
- 54328:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v4
# ARC's default runner image is bare; install the toolchain needed to
# compile native deps.
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends make build-essential
# Forge fork of erlef/setup-beam: defaults ImageOS to ubuntu-24.04,
# since forgejo/act injects an unmappable ImageOS from the runs-on label.
- uses: https://gg.neiam.co/neiam/action-setup-beam@v1
with:
# Match the build image in the Dockerfile (OTP must be >= 27.3.3).
elixir-version: "1.20.4"
otp-version: "28.5.0.8"
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- run: mix deps.get
# `mix precommit` = compile --warnings-as-errors, deps.unlock --unused,
# format, test (which creates + migrates the test DB).
- run: mix precommit
image:
needs: [test]
if: github.server_url != 'https://github.com' && github.event_name != 'pull_request'
runs-on: arc-runner-set
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
# The username is ignored by the token endpoint, but login-action
# requires it to be non-empty.
- name: Log in to the forge registry
uses: docker/login-action@v3
with:
registry: ${{ vars.CI_REGISTRY }}
username: gitgud-actions
password: ${{ github.token }}
# Public registries, off on the forge (GitHub pushes them). To push
# from here too, uncomment these logins and the extra `images:` lines.
# - name: Log in to GHCR
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ vars.GHCR_USER || github.actor }}
# password: ${{ secrets.GHCR_TOKEN }}
#
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# registry: docker.io
# username: ${{ secrets.DOCKERHUB_USER }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Log in to Quay
# uses: docker/login-action@v3
# with:
# registry: quay.io
# username: ${{ secrets.QUAY_USERNAME }}
# password: ${{ secrets.QUAY_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
# metadata-action skips '#' lines in its inputs.
images: |
${{ vars.CI_REGISTRY }}/${{ github.repository }}
# ghcr.io/${{ github.repository }}
# docker.io/neiam/waxx
# quay.io/neiam/waxx
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache
cache-to: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache,mode=max
neiam
/waxx
waxx
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
5.7 KiB · text
History
f06ce3a