ci(goreleaser): fix Go 1.11 WindowsXP build with vendor+goregexp #28
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: | |
| name: basic checks (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-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 -count=1 ./... | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Build packages | |
| run: go build ./... | |
| 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" . |