pantry/.github/workflows/ci.yml
2023-12-20 17:34:32 -05:00

93 lines
2.5 KiB
YAML

name: ci
run-name: "ci: ${{ github.event.pull_request.title }}"
on:
pull_request:
paths:
- projects/**/*
- .github/workflows/ci.yml
concurrency:
group: ci/${{ github.event.pull_request.head.ref }}
cancel-in-progress: true
jobs:
plan:
runs-on: ubuntu-latest
outputs:
pkgs: ${{ steps.diff.outputs.pkgs }}
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
id: get-diff
with:
PATTERNS: projects/**/package.yml
- id: diff
run: |
for x in ${{ steps.get-diff.outputs.diff }}; do
y=$(echo $x | sed 's#projects/\(.*\)/[^/]*#\1#')
RESULT="$RESULT ${y//$'\n'/}"
done
if [ -n "$RESULT" ]; then
RESULT="$(echo -n $RESULT | jq -R -s -c 'split(" ")')"
else
RESULT='["zlib.net"]'
fi
echo "pkgs=$RESULT" >> $GITHUB_OUTPUT
build:
if: needs.plan.outputs.pkgs
needs: plan
name: ci ${{ matrix.platform.name }} ${{matrix.pkg}}
strategy:
fail-fast: false
matrix:
pkg: ${{ fromJSON(needs.plan.outputs.pkgs) }}
platform:
- os: ["self-hosted", "macOS", "X64"]
name: x64
- os: ["self-hosted", "macOS", "ARM64"]
name: ²
- os: ["self-hosted", "linux", "ARM64"]
name: "*nix·ARM64"
- os: { group: "linux-x86-64" }
container: debian:buster-slim
name: "*nix64"
runs-on: ${{ matrix.platform.os }}
container: ${{ matrix.platform.container }}
env:
PKGX_PANTRY_PATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_P12 }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
- uses: pkgxdev/setup@v2
with:
PKGX_DIR: /opt
- uses: pkgxdev/brewkit/build@v1
id: build
with:
pkg: ${{ matrix.pkg }}
- uses: pkgxdev/brewkit/audit@v1
with:
pkg: ${{ matrix.pkg }}
if: steps.build.outputs.pkgspec
# prevent tests passing because the build directory is still there
- name: wipe builds directory
run: |
test -d builds
rm -rf builds
if: steps.build.outputs.pkgspec
- uses: pkgxdev/brewkit/test@v1
with:
pkg: ${{ matrix.pkg }}
if: steps.build.outputs.pkgspec