build: switch to go-re2 fork with bundled static RE2 #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| basic-linux: | |
| name: basic checks (ubuntu) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: v2 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.x' | |
| cache: true | |
| cache-dependency-path: v2/go.sum | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Test | |
| run: go test -tags "re2_cgo re2_static" -count=1 ./... | |
| - name: Vet | |
| run: go vet -tags "re2_cgo re2_static" ./... | |
| - name: Build packages | |
| run: go build -tags "re2_cgo re2_static" ./... | |
| basic-windows: | |
| name: basic checks (windows) | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| working-directory: v2 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| pacboy: gcc:p go:p | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Test | |
| run: go test -tags "re2_cgo re2_static" -count=1 ./... | |
| - name: Vet | |
| run: go vet -tags "re2_cgo re2_static" ./... | |
| - name: Build packages | |
| run: go build -tags "re2_cgo re2_static" ./... | |
| go111-build: | |
| name: Go 1.11 compatibility build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Go for vendoring | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.x' | |
| cache: true | |
| cache-dependency-path: v2/go.sum | |
| - name: Prepare Go 1.11 vendor tree | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| export GO111MODULE=on | |
| export GOPATH="${RUNNER_TEMP}/go111-gopath" | |
| src="${GOPATH}/src/github.com/chainreactors/gogo/v2" | |
| mkdir -p "$(dirname "${src}")" | |
| # NOTE: cmd/tinygo is excluded — it targets the TinyGo compiler (build | |
| # tag 'tinygo') and imports github.com/chainreactors/rem/x/netdev, which | |
| # is unrelated to the Go 1.11 WindowsXP build (root package + forceposix) | |
| # and is not present in the public rem module. Excluding it keeps | |
| # 'go mod vendor' from resolving that import. tinygo is tracked separately. | |
| rsync -a --delete \ | |
| --exclude '.git' \ | |
| --exclude '.claude' \ | |
| --exclude '.tmp' \ | |
| --exclude '.toolchain' \ | |
| --exclude 'dist' \ | |
| --exclude 'vendor' \ | |
| --exclude '*.exe' \ | |
| --exclude 'cmd/tinygo' \ | |
| v2/ "${src}/" | |
| cd "${src}" | |
| go mod vendor | |
| - name: Set up Go 1.11 | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.11.13' | |
| - name: Build Windows 386 binary with Go 1.11 | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| export GOPATH="${RUNNER_TEMP}/go111-gopath" | |
| cd "${GOPATH}/src/github.com/chainreactors/gogo/v2" | |
| mkdir -p dist | |
| GO111MODULE=off \ | |
| GOOS=windows \ | |
| GOARCH=386 \ | |
| CGO_ENABLED=0 \ | |
| go build -o dist/gogo_windowsxp_386.exe -tags="forceposix goregexp" . |