ci: simplify pipeline to single test job without format/credo checks

Removes:
- Separate compile/quality/test jobs
- Format and Credo checks
- Artifact upload/download between jobs

Now:
- Single test job that compiles and tests
- Build job runs after test passes
- All caching preserved for performance
- Compile with warnings-as-errors still enforced
This commit is contained in:
Graham McIntire 2026-03-05 16:49:06 -06:00
parent 3f1d97218d
commit 94099745d4
No known key found for this signature in database

View file

@ -8,143 +8,16 @@ on:
env:
DOCKER_BUILDKIT: 1
DOCKER_TLS_CERTDIR: ""
MIX_ENV: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
compile:
runs-on: ubuntu-22.04
env:
MIX_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Elixir
uses: https://github.com/erlef/setup-beam@v1
with:
otp-version: '28.3'
elixir-version: '1.19.5'
version-type: strict
- name: Cache system dependencies
uses: actions/cache@v4
id: system-deps-cache
with:
path: /var/cache/apt
key: ${{ runner.os }}-apt-${{ hashFiles('.forgejo/workflows/build.yaml') }}
restore-keys: ${{ runner.os }}-apt-
- name: Install system dependencies
run: |
if [ "${{ steps.system-deps-cache.outputs.cache-hit }}" != "true" ]; then
sudo apt-get update
fi
sudo apt-get install -y --no-install-recommends libsnmp-dev snmp-mibs-downloader
- name: Cache Hex packages
uses: actions/cache@v4
with:
path: |
~/.hex
~/.mix
key: ${{ runner.os }}-hex-mix-elixir-1.19.5-otp-28.3
restore-keys: ${{ runner.os }}-hex-mix-
- name: Cache Mix dependencies
uses: actions/cache@v4
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}-elixir-1.19.5-otp-28.3
restore-keys: |
${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}-
${{ runner.os }}-mix-deps-
- name: Cache Rust/Cargo build
uses: actions/cache@v4
with:
path: |
native/towerops_native/target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('native/towerops_native/Cargo.lock') }}-${{ hashFiles('native/towerops_native/src/**/*.rs') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('native/towerops_native/Cargo.lock') }}-
${{ runner.os }}-cargo-
- name: Cache compiled build
uses: actions/cache@v4
id: build-cache
with:
path: _build
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}-${{ hashFiles('lib/**/*.ex') }}-${{ hashFiles('native/**/*.rs') }}-elixir-1.19.5-otp-28.3
restore-keys: |
${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}-
${{ runner.os }}-mix-build-
- name: Install dependencies
run: mix deps.get
- name: Compile dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile
- name: Compile project with warnings as errors
run: mix compile --warnings-as-errors
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
_build/test
deps
retention-days: 1
quality:
runs-on: ubuntu-22.04
needs: compile
strategy:
fail-fast: false
matrix:
task: [format, credo]
env:
MIX_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Elixir
uses: https://github.com/erlef/setup-beam@v1
with:
otp-version: '28.3'
elixir-version: '1.19.5'
version-type: strict
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Install dependencies
run: mix deps.get --only test
- name: Check code formatting
if: matrix.task == 'format'
run: mix format --check-formatted
- name: Run Credo
if: matrix.task == 'credo'
run: mix credo --strict
test:
runs-on: ubuntu-22.04
needs: compile
env:
MIX_ENV: test
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/towerops_test
services:
postgres:
@ -170,28 +43,79 @@ jobs:
elixir-version: '1.19.5'
version-type: strict
- name: Install system dependencies
run: sudo apt-get install -y --no-install-recommends libsnmp-dev snmp-mibs-downloader postgresql-client
- name: Download build artifacts
uses: actions/download-artifact@v3
- name: Cache system dependencies
uses: actions/cache@v4
id: system-deps-cache
with:
name: build-artifacts
path: /var/cache/apt
key: ${{ runner.os }}-apt-${{ hashFiles('.forgejo/workflows/build.yaml') }}
restore-keys: ${{ runner.os }}-apt-
- name: Install system dependencies
run: |
if [ "${{ steps.system-deps-cache.outputs.cache-hit }}" != "true" ]; then
sudo apt-get update
fi
sudo apt-get install -y --no-install-recommends libsnmp-dev snmp-mibs-downloader postgresql-client
- name: Cache Hex packages
uses: actions/cache@v4
with:
path: |
~/.hex
~/.mix
key: ${{ runner.os }}-hex-mix-elixir-1.19.5-otp-28.3
restore-keys: ${{ runner.os }}-hex-mix-
- name: Cache Mix dependencies
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}-elixir-1.19.5-otp-28.3
restore-keys: |
${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}-
${{ runner.os }}-mix-deps-
- name: Cache Rust/Cargo build
uses: actions/cache@v4
with:
path: |
native/towerops_native/target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('native/towerops_native/Cargo.lock') }}-${{ hashFiles('native/towerops_native/src/**/*.rs') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('native/towerops_native/Cargo.lock') }}-
${{ runner.os }}-cargo-
- name: Cache compiled build
uses: actions/cache@v4
with:
path: _build
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}-${{ hashFiles('lib/**/*.ex') }}-${{ hashFiles('native/**/*.rs') }}-elixir-1.19.5-otp-28.3
restore-keys: |
${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}-
${{ runner.os }}-mix-build-
- name: Install dependencies
run: mix deps.get --only test
run: mix deps.get
- name: Compile dependencies
run: mix deps.compile
- name: Wait for PostgreSQL
run: |
timeout 30 bash -c 'until pg_isready -h postgres -p 5432 -U postgres; do sleep 1; done'
echo "PostgreSQL is ready!"
- name: Run tests
run: mix test --warnings-as-errors
- name: Compile and test
run: |
mix compile --warnings-as-errors
mix test --warnings-as-errors
build:
runs-on: ubuntu-22.04
needs: [quality, test]
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4