Skip to content

Nothing shows how long somebody has been a member #2441

Nothing shows how long somebody has been a member

Nothing shows how long somebody has been a member #2441

Workflow file for this run

name: CI
# Runs the same checks as `mix precommit` (compile --warnings-as-errors,
# unused-deps, format, credo --strict, tests) on every pull request, which is
# the gate: the only way into main is a merged, CI-green PR.
#
# The push-to-main run is deliberately NOT the belt-and-braces copy it used to
# be. With the squash-merge flow it re-tested the same tree the PR had just
# tested green, so every change cost two full runs and the second one had
# almost nothing left to catch. What it *did* still earn is the shared build
# cache: a cache written on a PR branch is not visible to other PRs, so only a
# run on the default branch refreshes the one every branch restores from. That
# cache is keyed on `mix.lock` + `config/*.exs`, so main now runs exactly when
# its key changes — which is both when the cache needs refreshing and when the
# change is riskiest.
#
# The trade this accepts: two PRs that are each green alone but conflict once
# merged are no longer caught here. The deploy's own build and `/health` gate
# is what stands behind that.
on:
pull_request:
push:
branches: [main]
paths:
- "mix.lock"
- "config/*.exs"
# A second push to the same branch makes the first run pointless — cancel it
# rather than paying for a verdict on a tree nobody will merge. Keyed on the
# ref, so runs on different PRs never cancel each other.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
precommit:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: vutuv1_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=10
env:
MIX_ENV: test
# config/test.exs reads the DB host from DATABASE_HOST.
DATABASE_HOST: 127.0.0.1
steps:
- uses: actions/checkout@v5
# pdftoppm renders the qualification proof-document PDFs
# (Vutuv.QualificationDocument); without it the PDF test paths
# capability-skip and lose their coverage.
- name: Install poppler-utils (PDF rendering) and ffmpeg (video on posts)
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends poppler-utils ffmpeg
- name: Set up Elixir/OTP
uses: erlef/setup-beam@v1
with:
# Pinned to match .tool-versions. Keep these two in sync with that
# file: a drift here installs the wrong toolchain and reds CI without
# affecting the deploy (the self-hosted runner builds its own).
otp-version: "28.5.0.1"
elixir-version: "1.20.0-otp-28"
# The key hashes config/*.exs too: compile-time application env for
# dependencies (e.g. the :mime :types map) is baked into the cached
# _build, and Elixir's compile-env validation rightly fails the build
# when a restored cache disagrees with the current config (this turned
# main red in v7.43.0 when activity+json was registered). restore-keys
# deliberately dropped for _build: a stale partial restore is exactly
# the poison the key is meant to prevent.
- name: Cache deps and _build
uses: actions/cache@v5
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('mix.lock', 'config/*.exs') }}
- run: mix deps.get
- run: mix precommit