tests.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ---
  2. name: Tests
  3. on:
  4. pull_request:
  5. branches:
  6. - main
  7. paths-ignore:
  8. - "docs/**"
  9. push:
  10. branches:
  11. - main
  12. paths-ignore:
  13. - "docs/**"
  14. permissions:
  15. contents: read
  16. jobs:
  17. tests:
  18. runs-on: ubuntu-latest
  19. strategy:
  20. fail-fast: false
  21. matrix:
  22. php-versions: ["8.2", "8.3", "8.4"]
  23. env:
  24. GOEXPERIMENT: cgocheck2
  25. GOMAXPROCS: 10
  26. LIBRARY_PATH: ${{ github.workspace }}/watcher/target/lib
  27. steps:
  28. - uses: actions/checkout@v4
  29. - uses: actions/setup-go@v5
  30. with:
  31. go-version: "1.22"
  32. cache-dependency-path: |
  33. go.sum
  34. caddy/go.sum
  35. - uses: shivammathur/setup-php@v2
  36. with:
  37. php-version: ${{ matrix.php-versions }}
  38. ini-file: development
  39. coverage: none
  40. tools: none
  41. env:
  42. phpts: ts
  43. debug: true
  44. - name: Install e-dant/watcher
  45. uses: ./.github/actions/watcher
  46. - name: Set Set CGO flags
  47. run: echo "CGO_CFLAGS=-I${PWD}/watcher/target/include $(php-config --includes)" >> "${GITHUB_ENV}"
  48. - name: Build
  49. run: go build
  50. - name: Build testcli binary
  51. working-directory: internal/testcli/
  52. run: go build
  53. - name: Run library tests
  54. run: go test -race -v ./...
  55. - name: Run Caddy module tests
  56. working-directory: caddy/
  57. run: go test -tags nobadger,nomysql,nopgx -race -v ./...
  58. - name: Run Fuzzing Tests
  59. working-directory: caddy/
  60. run: go test -fuzz FuzzRequest -fuzztime 20s
  61. - name: Build the server
  62. working-directory: caddy/frankenphp/
  63. run: go build
  64. - name: Start the server
  65. working-directory: testdata/
  66. run: sudo ../caddy/frankenphp/frankenphp start
  67. - name: Run integrations tests
  68. run: ./reload_test.sh
  69. - name: Lint Go code
  70. uses: golangci/golangci-lint-action@v6
  71. if: matrix.php-versions == '8.4'
  72. with:
  73. version: latest