2023-12-01 16:26:21 +00:00
|
|
|
---
|
2022-10-19 22:08:11 +00:00
|
|
|
name: Tests
|
2023-10-05 09:54:33 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-03-13 17:33:51 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2023-10-05 09:54:33 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-03-13 17:33:51 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2024-08-04 12:05:54 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-10-19 22:08:11 +00:00
|
|
|
jobs:
|
2023-07-04 12:45:31 +00:00
|
|
|
tests:
|
2022-10-19 22:08:11 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-10-21 13:23:23 +00:00
|
|
|
strategy:
|
2023-10-05 09:54:33 +00:00
|
|
|
fail-fast: false
|
2022-10-21 13:23:23 +00:00
|
|
|
matrix:
|
2024-08-12 20:26:19 +00:00
|
|
|
php-versions: ['8.2', '8.3', '8.4']
|
2024-01-23 00:49:29 +00:00
|
|
|
env:
|
|
|
|
GOEXPERIMENT: cgocheck2
|
2024-07-09 07:39:03 +00:00
|
|
|
GOMAXPROCS: 10
|
2024-10-07 11:17:24 +00:00
|
|
|
EDANT_WATCHER_VERSION: next
|
2022-10-19 22:08:11 +00:00
|
|
|
steps:
|
2023-10-05 09:54:33 +00:00
|
|
|
-
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
-
|
2023-12-11 11:58:19 +00:00
|
|
|
uses: actions/setup-go@v5
|
2022-10-19 22:08:11 +00:00
|
|
|
with:
|
2024-02-12 09:00:46 +00:00
|
|
|
go-version: '1.22'
|
2023-09-14 16:28:31 +00:00
|
|
|
cache-dependency-path: |
|
|
|
|
go.sum
|
|
|
|
caddy/go.sum
|
2023-10-05 09:54:33 +00:00
|
|
|
-
|
|
|
|
uses: shivammathur/setup-php@v2
|
2022-10-19 22:08:11 +00:00
|
|
|
with:
|
2023-07-04 12:45:31 +00:00
|
|
|
php-version: ${{ matrix.php-versions }}
|
|
|
|
ini-file: development
|
2023-07-04 14:54:40 +00:00
|
|
|
coverage: none
|
2023-10-05 09:54:33 +00:00
|
|
|
tools: none
|
2023-07-04 12:45:31 +00:00
|
|
|
env:
|
|
|
|
phpts: ts
|
2024-05-21 08:50:34 +00:00
|
|
|
debug: true
|
2024-10-07 11:17:24 +00:00
|
|
|
-
|
|
|
|
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/
|
2024-10-07 11:32:42 +00:00
|
|
|
cc -o libwatcher.so ./src/watcher-c.cpp -I ./include -I ../include -std=c++17 -O3 -Wall -Wextra -fPIC -shared
|
2024-10-07 11:17:24 +00:00
|
|
|
sudo cp libwatcher.so /usr/local/lib/libwatcher.so
|
|
|
|
sudo ldconfig
|
2023-10-05 09:54:33 +00:00
|
|
|
-
|
|
|
|
name: Set CGO flags
|
|
|
|
run: |
|
|
|
|
echo "CGO_CFLAGS=$(php-config --includes)" >> "$GITHUB_ENV"
|
|
|
|
-
|
|
|
|
name: Build
|
2024-01-23 00:49:29 +00:00
|
|
|
run: go build
|
2023-10-09 12:38:15 +00:00
|
|
|
-
|
|
|
|
name: Build testcli binary
|
|
|
|
working-directory: internal/testcli/
|
|
|
|
run: go build
|
2023-10-05 09:54:33 +00:00
|
|
|
-
|
|
|
|
name: Run library tests
|
2024-10-08 21:23:53 +00:00
|
|
|
run: go test -tags watcher -race -v ./...
|
2023-10-05 09:54:33 +00:00
|
|
|
-
|
|
|
|
name: Run Caddy module tests
|
2023-07-04 12:45:31 +00:00
|
|
|
working-directory: caddy/
|
2024-10-08 21:23:53 +00:00
|
|
|
run: go test -tags watcher -race -v ./...
|
2023-12-18 08:05:49 +00:00
|
|
|
-
|
|
|
|
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
|
2023-12-01 16:26:21 +00:00
|
|
|
-
|
|
|
|
name: Lint Go code
|
2024-05-13 11:28:01 +00:00
|
|
|
uses: golangci/golangci-lint-action@v6
|
2024-05-21 08:50:34 +00:00
|
|
|
if: matrix.php-versions == '8.3'
|
2023-12-01 16:26:21 +00:00
|
|
|
with:
|
|
|
|
version: latest
|