build-configs/templates/ci/github-actions/ci.yml.twig
Oliver Davies 17142d868f feat(github-actions): run tests first
The tests are the most valuable part of the CI pipeline, so these should
be run first.

If a PHPCS or PHPStan error occurs but the tests pass, we know the
functionality works and the error can be addressed.

If a test fails, the CI pipeline will fail sooner.

In the future, the tasks could be split into separate jobs though it
would need to be done in a way that doesn't add a lot of repetition.

Refs: OD-41
2023-08-19 08:40:15 +01:00

52 lines
1.1 KiB
Twig

name: CI
on:
pull_request:
push:
workflow_dispatch:
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_UID: 1001
jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Install just
run: |
curl --proto '=https' \
--tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
- name: Checkout the code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Build and test
run: |
docker compose version
docker network create traefik_proxy
cp --no-clobber .env.example .env
docker compose build --progress plain
docker compose up --detach
docker compose logs
just composer install --quiet --no-progress
just test --testdox --colors=always
{% if "phpcs" in php|keys -%}
just _run php phpcs
{%- endif %}
{% if "phpstan" in php|keys -%}
just _run php phpstan analyze --no-progress --memory-limit=512M
{%- endif %}