name: checks
# A pull request's build and tests: the app compiled and `mix test`
# against a throwaway PostGIS. Every pull request — the security update
# PRs gg-security opens (dependency-updates.yml) most of all, since a
# bump that resolves isn't one that builds.
#
# The Android app has its own (android.yml).
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
# 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:
runs-on: self-hosted
services:
# PostGIS, as compose.yml runs: photo positions are PostGIS points,
# and the first migrations create the extension.
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: csnap
POSTGRES_PASSWORD: csnap
options: >-
--health-cmd "pg_isready -U csnap"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
MIX_ENV: test
CARTOSNAP_TEST_DB_HOST: postgres
CARTOSNAP_TEST_DB_PORT: "5432"
# Postgres takes 100 connections; the runner has cores for more.
CARTOSNAP_TEST_DB_POOL_SIZE: "40"
steps:
- uses: actions/checkout@v4
# As the Dockerfile's builder: a C compiler for bcrypt's NIF, git
# for the heroicons dependency. And ImageMagick, as the release
# image has: the tests read and resize real images through it.
- name: Build dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y -q --no-install-recommends build-essential git imagemagick
# The app calls ImageMagick 7's `magick`; Ubuntu's ImageMagick is 6,
# whose `convert` takes the same arguments for everything the app does.
if ! command -v magick > /dev/null; then
printf '#!/bin/sh\nexec convert "$@"\n' | sudo tee /usr/local/bin/magick > /dev/null
sudo chmod +x /usr/local/bin/magick
fi
magick -version | head -1
# The same toolchain the Dockerfile builds with.
# OTP and Elixir from builds.hex.pm, the builds setup-beam would
# fetch — taken directly, since setup-beam chooses one by ImageOS,
# which this runner sets to "selfhosted" over anything a workflow
# says.
- name: OTP and Elixir
env:
OTP_VERSION: "28.5.0.8"
ELIXIR_VERSION: "1.20.4"
run: |
ubuntu=$(. /etc/os-release && echo "$VERSION_ID")
curl -sSfL "https://builds.hex.pm/builds/otp/ubuntu-${ubuntu}/OTP-${OTP_VERSION}.tar.gz" | tar xz -C /tmp
# Installed where it's unpacked: Install's root is its own directory.
(cd "/tmp/OTP-${OTP_VERSION}" && ./Install -minimal "/tmp/OTP-${OTP_VERSION}" > /dev/null)
curl -sSfL -o /tmp/elixir.zip "https://builds.hex.pm/builds/elixir/v${ELIXIR_VERSION}-otp-${OTP_VERSION%%.*}.zip"
unzip -q -d /tmp/elixir /tmp/elixir.zip
echo "/tmp/OTP-${OTP_VERSION}/bin" >> "$GITHUB_PATH"
echo /tmp/elixir/bin >> "$GITHUB_PATH"
- name: Dependencies
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Compile
run: mix compile
# The `test` alias creates and migrates the database first.
- name: Test
run: mix test
neiam
/cartosnap_ex
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
3.5 KiB · text
History
44bc4f7