Replace unreliable SourceForge mirror with GitHub release for gcc dow… #378
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
| # Workflow file of GitHub Actions | |
| name: build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feature/** | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| Lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout scm | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v9 | |
| CodeQL: | |
| needs: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout scm | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v4 | |
| with: | |
| languages: go | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v4 | |
| Test: | |
| needs: Lint | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ darwin, linux, windows, freebsd, js ] | |
| arch: [ 386, amd64, armv6, armv7, arm64, loong64, mips, mipsle, mips64, mips64le, ppc64, ppc64le, riscv64, s390x, wasm ] | |
| go: [ '1.18', '1.19', '1.20', '1.21', '1.22', '1.23', '1.24', '1.25', '1.26' ] | |
| exclude: | |
| # darwin excludes | |
| - os: darwin | |
| arch: 386 | |
| - os: darwin | |
| arch: armv6 | |
| - os: darwin | |
| arch: armv7 | |
| - os: darwin | |
| arch: loong64 | |
| - os: darwin | |
| arch: mips | |
| - os: darwin | |
| arch: mipsle | |
| - os: darwin | |
| arch: mips64 | |
| - os: darwin | |
| arch: mips64le | |
| - os: darwin | |
| arch: ppc64 | |
| - os: darwin | |
| arch: ppc64le | |
| - os: darwin | |
| arch: riscv64 | |
| - os: darwin | |
| arch: s390x | |
| - os: darwin | |
| arch: wasm | |
| # linux excludes | |
| - os: linux | |
| arch: loong64 | |
| go: 1.18 | |
| - os: linux | |
| arch: mips64 | |
| go: 1.22 | |
| - os: linux | |
| arch: mips64le | |
| go: 1.22 | |
| - os: linux | |
| arch: wasm | |
| # windows excludes | |
| - os: windows | |
| arch: armv6 | |
| - os: windows | |
| arch: armv7 | |
| - os: windows | |
| arch: arm64 | |
| - os: windows | |
| arch: loong64 | |
| - os: windows | |
| arch: mips | |
| - os: windows | |
| arch: mipsle | |
| - os: windows | |
| arch: mips64 | |
| - os: windows | |
| arch: mips64le | |
| - os: windows | |
| arch: ppc64 | |
| - os: windows | |
| arch: ppc64le | |
| - os: windows | |
| arch: riscv64 | |
| - os: windows | |
| arch: s390x | |
| - os: windows | |
| arch: wasm | |
| # freebsd excludes | |
| - os: freebsd | |
| arch: armv6 | |
| - os: freebsd | |
| arch: armv7 | |
| - os: freebsd | |
| arch: arm64 | |
| - os: freebsd | |
| arch: loong64 | |
| - os: freebsd | |
| arch: mips | |
| - os: freebsd | |
| arch: mipsle | |
| - os: freebsd | |
| arch: mips64 | |
| - os: freebsd | |
| arch: mips64le | |
| - os: freebsd | |
| arch: ppc64 | |
| - os: freebsd | |
| arch: ppc64le | |
| - os: freebsd | |
| arch: riscv64 | |
| - os: freebsd | |
| arch: s390x | |
| - os: freebsd | |
| arch: wasm | |
| # js excludes | |
| - os: js | |
| arch: 386 | |
| - os: js | |
| arch: amd64 | |
| - os: js | |
| arch: armv6 | |
| - os: js | |
| arch: armv7 | |
| - os: js | |
| arch: arm64 | |
| - os: js | |
| arch: loong64 | |
| - os: js | |
| arch: mips | |
| - os: js | |
| arch: mipsle | |
| - os: js | |
| arch: mips64 | |
| - os: js | |
| arch: mips64le | |
| - os: js | |
| arch: ppc64 | |
| - os: js | |
| arch: ppc64le | |
| - os: js | |
| arch: riscv64 | |
| - os: js | |
| arch: s390x | |
| include: | |
| # combine runs on | |
| - os: darwin | |
| runs-on: macos-13 | |
| - os: darwin | |
| arch: arm64 | |
| runs-on: macos-latest | |
| - os: linux | |
| runs-on: ubuntu-latest | |
| - os: windows | |
| runs-on: windows-latest | |
| - os: freebsd | |
| runs-on: ubuntu-latest | |
| - os: js | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout scm | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| cache: false | |
| # darwin | |
| - name: 'Test on [darwin] arch [amd64]' | |
| if: ${{ matrix.os == 'darwin' && contains(fromJson('["amd64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -race -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Test on [darwin] arch [arm64]' | |
| if: ${{ matrix.os == 'darwin' && contains(fromJson('["arm64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -race -coverprofile='coverage.txt' -covermode=atomic ./... | |
| # linux | |
| - name: 'Test on [linux] arch [386]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["386"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Test on [linux] arch [amd64]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["amd64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -race -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Setup qemu-user-static on [linux] arch [armv6, armv7, arm64, mips, mipsle, mips64, mips64le, ppc64, ppc64le, riscv64, s390x]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["armv6", "armv7", "arm64", "mips", "mipsle", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x"]'), matrix.arch) }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install qemu-user-static | |
| - name: 'Test on [linux] arch [armv6]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["armv6"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: arm | |
| GOARM: 6 | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Test on [linux] arch [armv7]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["armv7"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: arm | |
| GOARM: 7 | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Test on [linux] arch [mips, mipsle]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["mips", "mipsle"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| GOMIPS: softfloat | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Test on [linux] arch [arm64, mips64, mips64le, ppc64, ppc64le, riscv64, s390x]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["arm64", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Setup qemu-loongarch64-static on [linux] arch [loong64]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["loong64"]'), matrix.arch) }} | |
| run: | | |
| sudo wget -O /usr/bin/qemu-loongarch64-static https://github.com/loongson/build-tools/releases/download/2025.02.21/qemu-loongarch64 | |
| sudo chmod +x /usr/bin/qemu-loongarch64-static | |
| sudo mkdir -p /usr/libexec/qemu-binfmt | |
| sudo ln -s /usr/bin/qemu-loongarch64-static /usr/libexec/qemu-binfmt/loongarch64-binfmt-P | |
| sudo sh -c 'echo ":qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/libexec/qemu-binfmt/loongarch64-binfmt-P:" > /proc/sys/fs/binfmt_misc/register' | |
| - name: 'Test on [linux] arch [loong64]' | |
| if: ${{ matrix.os == 'linux' && contains(fromJson('["loong64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| # windows | |
| - name: 'Test on [windows] arch [386]' | |
| if: ${{ matrix.os == 'windows' && contains(fromJson('["386"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: 'Downgrade gcc for go1.18 on [windows] arch [amd64]' | |
| if: ${{ matrix.os == 'windows' && contains(fromJson('["amd64"]'), matrix.arch) && matrix.go == '1.18' }} | |
| run: | | |
| Invoke-WebRequest -Uri 'https://github.com/timandy/mingw-builds-binaries/releases/download/8.1.0-rt_v6-rev0/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z' -OutFile gcc8.7z | |
| Remove-Item 'C:\mingw64' -Recurse -Force | |
| 7z x gcc8.7z -oC:\ -y | |
| gcc --version | |
| - name: 'Test on [windows] arch [amd64]' | |
| if: ${{ matrix.os == 'windows' && contains(fromJson('["amd64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -race -coverprofile='coverage.txt' -covermode=atomic ./... | |
| # freebsd | |
| - name: 'Build for [freebsd] arch [386, amd64]' | |
| if: ${{ matrix.os == 'freebsd' && contains(fromJson('["386", "amd64"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: go test -v -c -covermode=atomic | |
| - name: 'Test on [freebsd] arch [386, amd64]' | |
| if: ${{ matrix.os == 'freebsd' && contains(fromJson('["386", "amd64"]'), matrix.arch) }} | |
| uses: vmactions/freebsd-vm@v1 | |
| with: | |
| run: ./routine.test -test.v -test.coverprofile='coverage.txt' | |
| # js | |
| - name: 'Setup Node.js on [js] arch [wasm]' | |
| if: ${{ matrix.os == 'js' && contains(fromJson('["wasm"]'), matrix.arch) }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 18 | |
| - name: 'Test on [js] arch [wasm]' | |
| if: ${{ matrix.os == 'js' && contains(fromJson('["wasm"]'), matrix.arch) }} | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: | | |
| go_version=$(go env GOVERSION | cut -c3-) | |
| max_version=$(printf '%s\n' "$go_version" '1.24' | sort -V | tail -n1) | |
| if [ "$go_version" = "$max_version" ]; then | |
| PATH="$PATH:$(go env GOROOT)/lib/wasm" | |
| else | |
| PATH="$PATH:$(go env GOROOT)/misc/wasm" | |
| fi | |
| go test -v -coverprofile='coverage.txt' -covermode=atomic ./... | |
| - name: Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| name: Codecov on ${{ matrix.os }}/${{ matrix.arch }} go${{ matrix.go }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false |