aprs.me/.forgejo/workflows/ci.yml
Graham McIntire a0c6b5a3b5
Some checks failed
Elixir CI / Dialyzer (push) Has been cancelled
Elixir CI / Build and test (push) Has been cancelled
Elixir CI / Build and Push Docker Image (push) Has been cancelled
fix: use runs-on: ubuntu-24.04 label so forgejo-runner derives correct ImageOS
forgejo's act runner unconditionally overwrites the ImageOS env var based on
the runs-on: platform label after job env is merged (run_context.go withGithubEnv),
hardcoding ubuntu-latest to ImageOS=ubuntu20 regardless of the actual container
image or any manual env override. Since ubuntu-20.04 has no stable OTP 29.0
builds, setup-beam failed even with an explicit ImageOS env var (silently
clobbered). Using the ubuntu-24.04 runner label (already registered to the
same node:24-bookworm image) makes the runner correctly derive ImageOS=ubuntu24,
which has real stable OTP 29.0 builds. Switched version-type back to strict
since we're now targeting a platform with the exact pinned versions.
2026-07-27 13:04:43 -05:00

162 lines
4.3 KiB
YAML

name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
name: Build and test
runs-on: ubuntu-24.04
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: aprsme_test
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MIX_ENV: test
PGHOST: postgres
steps:
- name: Configure git for submodules
run: |
git config --global url."https://oauth2:${{ secrets.FORGEJO_TOKEN }}@git.mcintire.me/".insteadOf "ssh://git@git.mcintire.me:2222/"
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Set up Elixir
uses: http://forgejo:3000/graham/setup-beam@v1
with:
version-type: strict
elixir-version: '1.20.2'
otp-version: '29.0'
- name: Restore dependency and build caches
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install Hex and Rebar
run: |
mix local.hex --force
mix local.rebar --force
- name: Fetch dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Compile (warnings as errors)
run: mix compile --warnings-as-errors
- name: Run Credo
run: mix credo --strict
- name: Run tests
run: mix test
- name: Run Sobelow
run: mix sobelow --config
- name: Run Hex Audit
run: mix hex.audit
dialyzer:
name: Dialyzer
runs-on: ubuntu-24.04
env:
MIX_ENV: dev
steps:
- name: Configure git for submodules
run: |
git config --global url."https://oauth2:${{ secrets.FORGEJO_TOKEN }}@git.mcintire.me/".insteadOf "ssh://git@git.mcintire.me:2222/"
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Set up Elixir
uses: http://forgejo:3000/graham/setup-beam@v1
with:
version-type: strict
elixir-version: '1.20.2'
otp-version: '29.0'
- name: Restore dependency and build caches
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-dialyzer-
- name: Install Hex and Rebar
run: |
mix local.hex --force
mix local.rebar --force
- name: Fetch dependencies
run: mix deps.get
- name: Run Dialyzer
run: mix dialyzer
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-24.04
needs: [quality, dialyzer]
if: github.event_name == 'push'
steps:
- name: Configure git for submodules
run: |
git config --global url."https://oauth2:${{ secrets.FORGEJO_TOKEN }}@git.mcintire.me/".insteadOf "ssh://git@git.mcintire.me:2222/"
- name: Checkout code
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Generate image tag
id: tag
run: |
TIMESTAMP=$(date +%s)
SHORT_SHA=$(git rev-parse --short=7 HEAD | cut -c1-7)
TAG="main-${TIMESTAMP}-${SHORT_SHA}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Install Docker CLI
run: |
apt-get update && apt-get install -y docker.io
- name: Build and Push
run: |
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login git.mcintire.me -u graham --password-stdin
docker build \
-t "git.mcintire.me/graham/aprs.me:${{ steps.tag.outputs.tag }}" \
-t "git.mcintire.me/graham/aprs.me:latest" \
.
docker push "git.mcintire.me/graham/aprs.me:${{ steps.tag.outputs.tag }}"
docker push "git.mcintire.me/graham/aprs.me:latest"