| 1 |
name: CI |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- main |
| 6 |
tags: |
| 7 |
- "*" |
| 8 |
pull_request: |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
permissions: |
| 12 |
contents: read |
| 13 |
|
| 14 |
jobs: |
| 15 |
build: |
| 16 |
runs-on: ${{ matrix.os }} |
| 17 |
strategy: |
| 18 |
fail-fast: false |
| 19 |
matrix: |
| 20 |
mode: |
| 21 |
- cgo |
| 22 |
- wasm2go |
| 23 |
- wazero |
| 24 |
os: |
| 25 |
- macos-15 |
| 26 |
- ubuntu-24.04 |
| 27 |
- windows-2025 |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 30 |
- uses: curioswitch/go-build/.github/actions/setup-go@338fc9f50df6cb664134b5c600630dcbc483d81f |
| 31 |
|
| 32 |
- name: setup re2 for cgo (linux) |
| 33 |
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.mode == 'cgo' }} |
| 34 |
run: sudo apt-get update && sudo apt-get install -y libre2-dev |
| 35 |
- name: setup re2 for cgo (mac) |
| 36 |
if: ${{ startsWith(matrix.os, 'macos-') && matrix.mode == 'cgo' }} |
| 37 |
run: brew install re2 |
| 38 |
- name: setup msys2 for cgo (windows) |
| 39 |
if: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'cgo' }} |
| 40 |
uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c |
| 41 |
with: |
| 42 |
update: true |
| 43 |
|
| 44 |
pacboy: gcc:p re2:p go:p pkg-config:p diffutils:p |
| 45 |
|
| 46 |
- name: run checks |
| 47 |
run: go run ./build ${{ startsWith(matrix.os, 'ubuntu-') && 'check' || 'test' }} |
| 48 |
if: ${{ !startsWith(matrix.os, 'windows-') || matrix.mode != 'cgo' }} |
| 49 |
env: |
| 50 |
RE2_TEST_MODE: ${{ matrix.mode }} |
| 51 |
|
| 52 |
|
| 53 |
RE2_TEST_EXHAUSTIVE: ${{ github.event_name != 'pull_request' && '1' || '0'}} |
| 54 |
|
| 55 |
GOMEMLIMIT: ${{ github.event_name != 'pull_request' && '1GiB' || '' }} |
| 56 |
|
| 57 |
TEST_NORACE: ${{ startsWith(matrix.os, 'windows-') && (matrix.mode == 'wazero' || matrix.mode == 'wasm2go') && 'true' || '' }} |
| 58 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 |
|
| 60 |
- name: run tests (windows cgo) |
| 61 |
run: go run ./build test |
| 62 |
if: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'cgo' }} |
| 63 |
|
| 64 |
shell: "msys2 {0}" |
| 65 |
env: |
| 66 |
RE2_TEST_MODE: ${{ matrix.mode }} |
| 67 |
|
| 68 |
|
| 69 |
RE2_TEST_EXHAUSTIVE: ${{ github.event_name != 'pull_request' && '1' || '0'}} |
| 70 |
|
| 71 |
GOMEMLIMIT: ${{ github.event_name != 'pull_request' && '1GiB' || '' }} |
| 72 |
|
| 73 |
test-bsd: |
| 74 |
runs-on: ubuntu-24.04 |
| 75 |
|
| 76 |
steps: |
| 77 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 78 |
- uses: curioswitch/go-build/.github/actions/setup-go@338fc9f50df6cb664134b5c600630dcbc483d81f |
| 79 |
|
| 80 |
- name: Build |
| 81 |
run: go test -c . |
| 82 |
env: |
| 83 |
GOOS: freebsd |
| 84 |
|
| 85 |
- name: Test |
| 86 |
uses: cross-platform-actions/action@0c165ad7eb2d6a7e8552d6af5aad2bbedfc646b0 |
| 87 |
with: |
| 88 |
operating_system: freebsd |
| 89 |
version: "14.0" |
| 90 |
shell: bash |
| 91 |
run: ./go-re2.test -test.v -test.short |
| 92 |
sync_files: runner-to-vm |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
docker-build: |
| 99 |
runs-on: ubuntu-24.04 |
| 100 |
container: |
| 101 |
image: golang:alpine |
| 102 |
steps: |
| 103 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 104 |
|
| 105 |
- run: if command -v gcc &> /dev/null; then echo "GCC found but not expected"; exit 2; fi |
| 106 |
|
| 107 |
- run: go run ./build test |
| 108 |
env: |
| 109 |
TEST_NORACE: "true" |