frankenphp/.github/workflows/tests.yaml
Kévin Dunglas e9c075a4a5
Some checks are pending
Lint Code Base / Lint Code Base (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (asan) (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (msan) (push) Waiting to run
Tests / tests (8.2) (push) Waiting to run
Tests / tests (8.3) (push) Waiting to run
Tests / tests (8.4) (push) Waiting to run
feat: add build tag to skip Watcher support (#1076)
* feat: add build tag to skip Watcher support

* fix

* fix

* cleanup
2024-10-08 23:23:53 +02:00

96 lines
2.3 KiB
YAML

---
name: Tests
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
push:
branches:
- main
paths-ignore:
- 'docs/**'
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3', '8.4']
env:
GOEXPERIMENT: cgocheck2
GOMAXPROCS: 10
EDANT_WATCHER_VERSION: next
steps:
-
uses: actions/checkout@v4
-
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: |
go.sum
caddy/go.sum
-
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-file: development
coverage: none
tools: none
env:
phpts: ts
debug: true
-
uses: actions/checkout@v4
name: Checkout watcher
with:
repository: e-dant/watcher
ref: ${{ env.EDANT_WATCHER_VERSION }}
path: 'edant/watcher'
-
name: Compile edant/watcher
run: |
cd edant/watcher/watcher-c/
cc -o libwatcher.so ./src/watcher-c.cpp -I ./include -I ../include -std=c++17 -O3 -Wall -Wextra -fPIC -shared
sudo cp libwatcher.so /usr/local/lib/libwatcher.so
sudo ldconfig
-
name: Set CGO flags
run: |
echo "CGO_CFLAGS=$(php-config --includes)" >> "$GITHUB_ENV"
-
name: Build
run: go build
-
name: Build testcli binary
working-directory: internal/testcli/
run: go build
-
name: Run library tests
run: go test -tags watcher -race -v ./...
-
name: Run Caddy module tests
working-directory: caddy/
run: go test -tags watcher -race -v ./...
-
name: Build the server
working-directory: caddy/frankenphp/
run: go build
-
name: Start the server
working-directory: testdata/
run: sudo ../caddy/frankenphp/frankenphp start
-
name: Run integrations tests
run: ./reload_test.sh
-
name: Lint Go code
uses: golangci/golangci-lint-action@v6
if: matrix.php-versions == '8.3'
with:
version: latest