fix: switch CI to debian:trixie-slim with setup-beam, add build step
Some checks failed
Elixir CI / Build and test (push) Failing after 1m17s
Elixir CI / Dialyzer (push) Failing after 57s
Elixir CI / Build and Push Docker Image (push) Has been skipped

This commit is contained in:
Graham McIntire 2026-07-27 08:18:56 -05:00
parent 91550bcdb1
commit c1b19fe662
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 167 additions and 39 deletions

View file

@ -1,39 +0,0 @@
name: Build and Push
on:
push:
branches:
- main
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: docker
steps:
- name: Checkout code
uses: https://github.com/actions/checkout@v4
- 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"

167
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,167 @@
name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
name: Build and test
runs-on: ubuntu-latest
container:
image: debian:trixie-slim
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: aprsme_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MIX_ENV: test
steps:
- name: Install system packages
run: |
apt-get update
apt-get install -y --no-install-recommends git ca-certificates nodejs npm
rm -rf /var/lib/apt/lists/*
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Set up Elixir
uses: https://github.com/erlef/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-latest
container:
image: debian:trixie-slim
env:
MIX_ENV: dev
steps:
- name: Install system packages
run: |
apt-get update
apt-get install -y --no-install-recommends git ca-certificates nodejs npm
rm -rf /var/lib/apt/lists/*
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Set up Elixir
uses: https://github.com/erlef/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-latest
needs: [quality, dialyzer]
if: github.event_name == 'push'
steps:
- 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"