Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions .github/workflows/sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
push:
branches:
- main
Expand All @@ -20,9 +18,32 @@ env:
GOTOOLCHAIN: local
GOTESTSUM_FORMAT: pkgname-and-test-fails
jobs:
# Docs-only PRs skip the jobs below instead of the whole workflow, so the required gate check still reports
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- id: filter
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
run: |
set -o pipefail
if [ -z "${PR}" ] || gh api --paginate "repos/${REPO}/pulls/${PR}/files" --jq '.[].filename' | grep -qv '^docs/'; then
echo "code=true" >> "${GITHUB_OUTPUT}"
else
echo "code=false" >> "${GITHUB_OUTPUT}"
fi
# Adapted from https://github.com/beberlei/hdrhistogram-php
sanitizers:
name: ${{ matrix.sanitizer }}
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -108,3 +129,21 @@ jobs:
} >> "$GITHUB_ENV"
- name: Run tests
run: gotestsum -- ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} -timeout ${{ matrix.sanitizer == 'msan' && '60m' || '30m' }} ./...
gate:
name: Sanitizers passed
if: always()
needs: [changes, sanitizers]
runs-on: ubuntu-latest
steps:
- env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in ${RESULTS}; do
case "${result}" in
success | skipped) ;;
*)
echo "::error::A required job ended with ${result}"
exit 1
;;
esac
done
47 changes: 45 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
push:
branches:
- main
Expand All @@ -21,8 +19,31 @@ env:
GOEXPERIMENT: cgocheck2
GOTESTSUM_FORMAT: pkgname-and-test-fails
jobs:
# Docs-only PRs skip the jobs below instead of the whole workflow, so the required gate check still reports
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- id: filter
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
run: |
set -o pipefail
if [ -z "${PR}" ] || gh api --paginate "repos/${REPO}/pulls/${PR}/files" --jq '.[].filename' | grep -qv '^docs/'; then
echo "code=true" >> "${GITHUB_OUTPUT}"
else
echo "code=false" >> "${GITHUB_OUTPUT}"
fi
tests-linux:
name: Tests (Linux, PHP ${{ matrix.php-versions }})
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
Expand Down Expand Up @@ -98,6 +119,8 @@ jobs:
working-directory: caddy/
integration-tests:
name: Integration Tests (Linux, PHP ${{ matrix.php-versions }})
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -134,6 +157,8 @@ jobs:
run: gotestsum -- -tags integration -timeout 30m
tests-mac:
name: Tests (macOS, PHP 8.5)
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: macos-latest
env:
HOMEBREW_NO_AUTO_UPDATE: 1
Expand All @@ -159,3 +184,21 @@ jobs:
- name: Run Caddy module tests
working-directory: caddy/
run: gotestsum -- -race ./...
gate:
name: Tests passed
if: always()
needs: [changes, tests-linux, integration-tests, tests-mac]
runs-on: ubuntu-latest
steps:
- env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in ${RESULTS}; do
case "${result}" in
success | skipped) ;;
*)
echo "::error::A required job ended with ${result}"
exit 1
;;
esac
done
1 change: 1 addition & 0 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ env:

jobs:
build:
name: Windows build
permissions:
contents: write
id-token: write
Expand Down
Loading