Skip to content

Modernize CI configuration #30

Modernize CI configuration

Modernize CI configuration #30

Workflow file for this run

name: ci
on:
push:
branches:
- master
- dev-1.x
- develop
pull_request:
branches:
- master
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PHP_VERSION:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
COVERAGE: ["true", "false"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I'm putting everything in a FSCKING BASH SCRIPT
env:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
COVERAGE: ${{ matrix.COVERAGE }}
run: bash ./.github/scripts/linux.sh
- name: Coveralls
if: ${{ matrix.COVERAGE == 'true' }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.info
# broken and don't care apple is trash
# osx:
# runs-on: macos-latest
# strategy:
# fail-fast: false
# matrix:
# PHP_VERSION:
# # - "8.1"
# # - "8.2"
# - "8.3"
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# - name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I'm putting everything in a FSCKING BASH SCRIPT
# env:
# PHP_VERSION: ${{ matrix.PHP_VERSION }}
# run: bash ./.github/scripts/osx.sh
docker-debian:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PHP_VERSION:
- "8.1"
- "8.2"
- "8.3"
- "8.4.0RC1"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I am putting everything in a FSCKING BASH SCRIPT
env:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
DOCKER_NAME: debian
run: bash ./.github/scripts/docker.sh
docker-alpine:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PHP_VERSION:
- "8.1"
- "8.2"
- "8.3"
- "8.4.0RC1"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I am putting everything in a FSCKING BASH SCRIPT
env:
PHP_VERSION: ${{ matrix.PHP_VERSION }}
DOCKER_NAME: alpine
run: bash ./.github/scripts/docker.sh
docker-fedora:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I am putting everything in a FSCKING BASH SCRIPT
env:
DOCKER_NAME: fedora
TEST_PHP_EXECUTABLE: /usr/bin/php
run: bash ./.github/scripts/docker.sh
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix:
name: "nix (${{ matrix.name }})"
runs-on: ${{ matrix.os }}
needs: nix-matrix
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set Up Build Cache
uses: actions/cache@v4
id: nix-cache
with:
path: /tmp/nix-store.nar
key: nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
restore-keys: |
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-
nix-store.nar-${{ runner.os }}-
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-24.05
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm"
- name: Import Nix Store Cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: |
nix-store --import < /tmp/nix-store.nar
- run: nix build -L ".#${{ matrix.attr }}"
- name: Export Nix Store Cache
shell: bash
# partially based on https://github.com/NixOS/nix/issues/1245#issuecomment-282586759
run: |
drv="$(nix-store -qd "$(readlink result)")"
drvRefs="$( echo "$drv" | xargs nix-store -q --references )"
( echo "$drvRefs" | grep '[.]drv$' | xargs nix-store -q --outputs ;
echo "$drvRefs" | grep -v '[.]drv$' ) | \
xargs nix-store -r | \
xargs nix-store -qR |
xargs nix-store --export > /tmp/nix-store.nar