github.com/madokast/nopreempt@v1.0.3-0.20240125081507-3fa05aef38ed/.github/workflows/go.yml (about) 1 name: Go 2 3 on: 4 push: 5 branches: 6 - main 7 pull_request: 8 branches: 9 - main 10 11 jobs: 12 build: 13 runs-on: ubuntu-latest 14 strategy: 15 fail-fast: false 16 matrix: 17 arch: 18 - aarch64 19 # - 386 20 - x64 21 go: 22 - '1.19' 23 - '1.20' 24 - '1.21' 25 # Race detector binaries crash with: 26 # 27 # FATAL: ThreadSanitizer: unsupported VMA range 28 # 29 # See https://github.com/golang/go/issues/29948. 30 arm64_unsupported_vma_range: 31 - true 32 # include: 33 # # Race builds are pretty much busted on Go 1.4 and below on systems 34 # # with newer C compilers. A number of fixes were backported to 35 # # go1.4-bootstrap but not any released version. See 36 # # https://github.com/golang/go/compare/go1.4.3...release-branch.go1.4. 37 # # 38 # # Race builds aren't supported on linux/386. 39 # # 40 # # Cross-compilation became possible in go1.5 with the removal of C 41 # # code from the compiler. See https://go.dev/doc/go1.5#c. 42 # # 43 # # Race builds aren't supported in gccgo. 44 # # 45 # # Cross-compilation isn't supported in gccgo. 46 # - arch: x64 47 # go: '1.3' 48 # x64_race_broken: true 49 # - arch: x64 50 # go: '1.4' 51 # x64_race_broken: true 52 # - arch: x64 53 # go: gccgo-9 54 # x64_race_broken: true 55 # - arch: x64 56 # go: gccgo-10 57 # x64_race_broken: true 58 # - arch: x64 59 # go: gccgo-11 60 # x64_race_broken: true 61 # - arch: x64 62 # go: gccgo-12 63 # x64_race_broken: true 64 # - arch: x64 65 # go: gccgo-13 66 # x64_race_broken: true 67 # # Go binaries built with Go 1.8 and below are incompatible with QEMU 68 # # user-level emulation. See 69 # # https://github.com/golang/go/commit/2673f9e. 70 # - arch: armv6 71 # go: '1.5' 72 # qemu_emulation_broken: true 73 # - arch: armv6 74 # go: '1.6' 75 # qemu_emulation_broken: true 76 # - arch: armv6 77 # go: '1.7' 78 # qemu_emulation_broken: true 79 # - arch: armv6 80 # go: '1.8' 81 # qemu_emulation_broken: true 82 # - arch: armv7 83 # go: '1.5' 84 # qemu_emulation_broken: true 85 # - arch: armv7 86 # go: '1.6' 87 # qemu_emulation_broken: true 88 # - arch: armv7 89 # go: '1.7' 90 # qemu_emulation_broken: true 91 # - arch: armv7 92 # go: '1.8' 93 # qemu_emulation_broken: true 94 # - arch: aarch64 95 # go: '1.5' 96 # qemu_emulation_broken: true 97 # - arch: aarch64 98 # go: '1.6' 99 # qemu_emulation_broken: true 100 # - arch: aarch64 101 # go: '1.7' 102 # qemu_emulation_broken: true 103 # - arch: aarch64 104 # go: '1.8' 105 # qemu_emulation_broken: true 106 # # Race detector support on linux/arm64 was added in go1.12. See 107 # # https://go.dev/doc/go1.12. 108 # - arch: aarch64 109 # go: '1.5' 110 # arm64_race_unsupported: true 111 # - arch: aarch64 112 # go: '1.6' 113 # arm64_race_unsupported: true 114 # - arch: aarch64 115 # go: '1.7' 116 # arm64_race_unsupported: true 117 # - arch: aarch64 118 # go: '1.8' 119 # arm64_race_unsupported: true 120 # - arch: aarch64 121 # go: '1.9' 122 # arm64_race_unsupported: true 123 # - arch: aarch64 124 # go: '1.10' 125 # arm64_race_unsupported: true 126 # - arch: aarch64 127 # go: '1.11' 128 # arm64_race_unsupported: true 129 steps: 130 - uses: actions/checkout@v4 131 - name: Set up Go 132 if: ${{ !startsWith(matrix.go, 'gccgo-') }} 133 uses: actions/setup-go@v5.0.0 134 with: 135 go-version: ${{ matrix.go }} 136 - name: Set up gccgo 137 if: ${{ startsWith(matrix.go, 'gccgo-') }} 138 run: | 139 sudo apt update && \ 140 sudo apt install -y ${{ matrix.go }} && \ 141 echo ${{ matrix.go }} | sed 's/^gcc//' | xargs -I % ln -s /usr/bin/% /usr/local/bin/go && \ 142 go version 143 - name: 'Build with ${{ matrix.go }}' 144 if: ${{ matrix.arch == 'x64' }} 145 run: go build -v ./... 146 - name: 'Build with ${{ matrix.go }}' 147 if: ${{ matrix.arch == '386' }} 148 env: 149 GOARCH: 386 150 run: go build -v ./... 151 # - name: 'Check that Get is inlined with ${{ matrix.go }}' 152 # if: ${{ !startsWith(matrix.go, 'gccgo-') && matrix.arch == 'x64' }} 153 # run: | 154 # if echo -e '${{ matrix.go }}\n1.12' | sort -V | head -n1 | xargs test 1.12 = ; then 155 # go build -gcflags='-m' 2>&1 | grep 'can inline Get$' > /dev/null 156 # fi 157 # - name: 'Check that Get is inlined with ${{ matrix.go }}' 158 # if: ${{ !startsWith(matrix.go, 'gccgo-') && matrix.arch == '386' }} 159 # env: 160 # GOARCH: 386 161 # run: | 162 # if echo -e '${{ matrix.go }}\n1.12' | sort -V | head -n1 | xargs test 1.12 = ; then 163 # go build -gcflags='-m' 2>&1 | grep 'can inline Get$' > /dev/null 164 # fi 165 - name: 'BuildRace with ${{ matrix.go }}' 166 if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }} 167 run: go build -race -v ./... 168 - name: 'Test with ${{ matrix.go }}' 169 if: ${{ matrix.arch == 'x64' }} 170 run: go test -v ./... 171 - name: 'Test with ${{ matrix.go }}' 172 if: ${{ matrix.arch == '386' }} 173 env: 174 GOARCH: 386 175 run: go test -v ./... 176 # - name: 'TestRace with ${{ matrix.go }}' 177 # if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }} 178 # run: go test -race -v ./... 179 - name: 'Bench with ${{ matrix.go }}' 180 if: ${{ matrix.arch == 'x64' }} 181 run: go test -bench=. -benchmem -v ./... 182 - name: 'Bench with ${{ matrix.go }}' 183 if: ${{ matrix.arch == '386' }} 184 env: 185 GOARCH: 386 186 run: go test -bench=. -benchmem -v ./... 187 # - name: 'BenchRace with ${{ matrix.go }}' 188 # if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }} 189 # run: go test -bench=. -benchmem -race -v ./... 190 - name: 'BuildTest with ${{ matrix.go }} for armv6' 191 if: ${{ matrix.arch == 'armv6' }} 192 env: 193 GOARCH: arm 194 GOARM: 6 195 run: go test -c ./... 196 - name: 'BuildTest with ${{ matrix.go }} for armv7' 197 if: ${{ matrix.arch == 'armv7' }} 198 env: 199 GOARCH: arm 200 GOARM: 7 201 run: go test -c ./... 202 - name: 'BuildTest with ${{ matrix.go }} for aarch64' 203 if: ${{ matrix.arch == 'aarch64' }} 204 env: 205 GOARCH: arm64 206 run: go test -c ./... 207 # - name: 'BuildTestRace with ${{ matrix.go }} for aarch64' 208 # if: ${{ matrix.arch == 'aarch64' && !matrix.arm64_race_unsupported }} 209 # env: 210 # GOARCH: arm64 211 # CGO_ENABLED: 1 212 # run: | 213 # # Non-host *.syso files are missing from the Go toolchains provided 214 # # by setup-go. See https://github.com/actions/setup-go/issues/181. 215 # curl --location --output $(go env GOROOT)/src/runtime/race/race_linux_arm64.syso \ 216 # https://github.com/golang/go/raw/release-branch.go${{ matrix.go }}/src/runtime/race/race_linux_arm64.syso && \ 217 # sudo apt update && \ 218 # sudo apt install gcc-aarch64-linux-gnu && \ 219 # CC=aarch64-linux-gnu-gcc CC_FOR_TARGET=gcc-aarch64-linux-gnu go test -c -race -o goid.race.test ./... 220 # - name: 'DeleteTestRace with $$ {{ matrix.go}} for aarch64' 221 # if: ${{ matrix.arch == 'aarch64' && !matrix.arm64_race_unsupported && matrix.arm64_unsupported_vma_range }} 222 # run: rm goid.race.test 223 - name: 'Test and Bench with ${{ matrix.go }} on ${{ matrix.arch }}' 224 if: ${{ matrix.arch != '386' && matrix.arch != 'x64' && !matrix.qemu_emulation_broken }} 225 uses: uraimo/run-on-arch-action@v2 226 with: 227 arch: ${{ matrix.arch }} 228 distro: bullseye 229 dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly 230 run: | 231 find /checkout -name '*.test' -type f -executable -print0 | \ 232 xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'