.github/workflows: reduce CI time for minor architectures (#417)
As the number of supported architectures has been increasing, CI time is the maintainers' concern. Test the minor archtectures (loong64, ppc64le, and riscv64) only with the latest Go in order to reduce CI time.
- commit
- d685103625c14fdd0b62bcca1e6c159841954c7b
- author
- Hajime Hoshi · · 2026-02-15 13:52 UTC
- committer
- GitHub · · 2026-02-15 13:52 UTC
- parent
- d8dcb88
- signature
- GPG Unverified
B5690EEEBB952194The key is unknown
1 file · +44 -40
M .github/workflows/test.yml +44 -40
| @@ -70,12 +70,14 @@ jobs: | |||
| 70 | 70 | env GOOS=netbsd GOARCH=amd64 go build -v ./... | |
| 71 | 71 | env GOOS=netbsd GOARCH=arm64 go build -v ./... | |
| 72 | 72 | ||
| 73 | - | - name: go build (Linux loong64) | |
| 74 | - | if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') && !startsWith(matrix.go, '1.22.') && !startsWith(matrix.go, '1.23.') && !startsWith(matrix.go, '1.24.') }} | |
| 73 | + | - name: go build (Linux minor architectures) | |
| 74 | + | # Test them only on the latest Go to reduce CI time. | |
| 75 | + | if: startsWith(matrix.go, '1.26.') | |
| 75 | 76 | run: | | |
| 76 | - | # Check cross-compiling Linux binaries for loong64. | |
| 77 | - | # Loong64 support internal linking from go1.25. | |
| 77 | + | # Check cross-compiling Linux binaries for minor architectures. | |
| 78 | 78 | env GOOS=linux GOARCH=loong64 go build -v ./... | |
| 79 | + | env GOOS=linux GOARCH=ppc64le go build -v ./... | |
| 80 | + | env GOOS=linux GOARCH=riscv64 go build -v ./... | |
| 79 | 81 | ||
| 80 | 82 | - name: go build (plugin) | |
| 81 | 83 | if: runner.os == 'Linux' || runner.os == 'macOS' | |
| @@ -140,36 +142,6 @@ jobs: | |||
| 140 | 142 | go env -u CC | |
| 141 | 143 | go env -u CXX | |
| 142 | 144 | ||
| 143 | - | - name: go test (Linux ppc64le) | |
| 144 | - | if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') }} | |
| 145 | - | run: | | |
| 146 | - | sudo apt-get update | |
| 147 | - | sudo apt-get install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu qemu-user | |
| 148 | - | go env -w CC=powerpc64le-linux-gnu-gcc | |
| 149 | - | go env -w CXX=powerpc64le-linux-gnu-g++ | |
| 150 | - | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |
| 151 | - | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |
| 152 | - | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |
| 153 | - | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |
| 154 | - | go env -u CC | |
| 155 | - | go env -u CXX | |
| 156 | - | ||
| 157 | - | - name: go test (Linux riscv64) | |
| 158 | - | if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') }} | |
| 159 | - | run: | | |
| 160 | - | sudo apt-get update | |
| 161 | - | sudo apt-get install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user | |
| 162 | - | go env -w CC=riscv64-linux-gnu-gcc | |
| 163 | - | go env -w CXX=riscv64-linux-gnu-g++ | |
| 164 | - | # Create symlink for the dynamic linker that QEMU expects | |
| 165 | - | sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1 | |
| 166 | - | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |
| 167 | - | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |
| 168 | - | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |
| 169 | - | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |
| 170 | - | go env -u CC | |
| 171 | - | go env -u CXX | |
| 172 | - | ||
| 173 | 145 | - name: go test race (no Cgo) | |
| 174 | 146 | if: ${{ runner.os == 'macOS' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }} | |
| 175 | 147 | run: | | |
| @@ -181,26 +153,34 @@ jobs: | |||
| 181 | 153 | run: | | |
| 182 | 154 | env CGO_ENABLED=1 go test -race -shuffle=on -v -count=10 ./... | |
| 183 | 155 | ||
| 184 | - | loong: | |
| 156 | + | minor-arches: | |
| 185 | 157 | strategy: | |
| 186 | 158 | matrix: | |
| 187 | - | # Loong64 support internal linking from go1.25. | |
| 188 | - | go: ['1.25.x', '1.26.x'] | |
| 189 | - | name: Test with Go ${{ matrix.go }} on Linux loong64 | |
| 159 | + | # Test them only on the latest Go to reduce CI time. | |
| 160 | + | go: ['1.26.x'] | |
| 161 | + | name: Test with Go ${{ matrix.go }} on Linux minor architectures | |
| 190 | 162 | runs-on: ubuntu-latest | |
| 191 | 163 | defaults: | |
| 192 | 164 | run: | |
| 193 | 165 | shell: bash | |
| 194 | 166 | steps: | |
| 195 | - | - uses: actions/checkout@v5 | |
| 167 | + | - name: Checkout | |
| 168 | + | uses: actions/checkout@v5 | |
| 169 | + | ||
| 196 | 170 | - name: Setup Go | |
| 197 | 171 | uses: actions/setup-go@v6 | |
| 198 | 172 | with: | |
| 199 | 173 | go-version: ${{ matrix.go }} | |
| 174 | + | ||
| 200 | 175 | - name: Set up the prerequisites | |
| 201 | 176 | run: | | |
| 202 | 177 | sudo apt-get update | |
| 203 | - | sudo apt-get install -y gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu qemu-user | |
| 178 | + | sudo apt-get install -y \ | |
| 179 | + | gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu \ | |
| 180 | + | gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \ | |
| 181 | + | gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \ | |
| 182 | + | qemu-user | |
| 183 | + | ||
| 204 | 184 | - name: go test (Linux loong64) | |
| 205 | 185 | run: | | |
| 206 | 186 | go env -w CC=loongarch64-linux-gnu-gcc-14 | |
| @@ -212,6 +192,30 @@ jobs: | |||
| 212 | 192 | go env -u CC | |
| 213 | 193 | go env -u CXX | |
| 214 | 194 | ||
| 195 | + | - name: go test (Linux ppc64le) | |
| 196 | + | run: | | |
| 197 | + | go env -w CC=powerpc64le-linux-gnu-gcc | |
| 198 | + | go env -w CXX=powerpc64le-linux-gnu-g++ | |
| 199 | + | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |
| 200 | + | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |
| 201 | + | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |
| 202 | + | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |
| 203 | + | go env -u CC | |
| 204 | + | go env -u CXX | |
| 205 | + | ||
| 206 | + | - name: go test (Linux riscv64) | |
| 207 | + | run: | | |
| 208 | + | go env -w CC=riscv64-linux-gnu-gcc | |
| 209 | + | go env -w CXX=riscv64-linux-gnu-g++ | |
| 210 | + | # Create symlink for the dynamic linker that QEMU expects | |
| 211 | + | sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1 | |
| 212 | + | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |
| 213 | + | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |
| 214 | + | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |
| 215 | + | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |
| 216 | + | go env -u CC | |
| 217 | + | go env -u CXX | |
| 218 | + | ||
| 215 | 219 | bsd: | |
| 216 | 220 | strategy: | |
| 217 | 221 | matrix: | |
| @@ -70,12 +70,14 @@ jobs: | |||||
| 70 | env GOOS=netbsd GOARCH=amd64 go build -v ./... | 70 | env GOOS=netbsd GOARCH=amd64 go build -v ./... | ||
| 71 | env GOOS=netbsd GOARCH=arm64 go build -v ./... | 71 | env GOOS=netbsd GOARCH=arm64 go build -v ./... | ||
| 72 | 72 | ||||
| 73 | - | - name: go build (Linux loong64) | 73 | + | - name: go build (Linux minor architectures) |
| 74 | - | if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') && !startsWith(matrix.go, '1.22.') && !startsWith(matrix.go, '1.23.') && !startsWith(matrix.go, '1.24.') }} | 74 | + | # Test them only on the latest Go to reduce CI time. |
| 75 | + | if: startsWith(matrix.go, '1.26.') | |||
| 75 | run: | | 76 | run: | | ||
| 76 | - | # Check cross-compiling Linux binaries for loong64. | 77 | + | # Check cross-compiling Linux binaries for minor architectures. |
| 77 | - | # Loong64 support internal linking from go1.25. | |||
| 78 | env GOOS=linux GOARCH=loong64 go build -v ./... | 78 | env GOOS=linux GOARCH=loong64 go build -v ./... | ||
| 79 | + | env GOOS=linux GOARCH=ppc64le go build -v ./... | |||
| 80 | + | env GOOS=linux GOARCH=riscv64 go build -v ./... | |||
| 79 | 81 | ||||
| 80 | - name: go build (plugin) | 82 | - name: go build (plugin) | ||
| 81 | if: runner.os == 'Linux' || runner.os == 'macOS' | 83 | if: runner.os == 'Linux' || runner.os == 'macOS' | ||
| @@ -140,36 +142,6 @@ jobs: | |||||
| 140 | go env -u CC | 142 | go env -u CC | ||
| 141 | go env -u CXX | 143 | go env -u CXX | ||
| 142 | 144 | ||||
| 143 | - | - name: go test (Linux ppc64le) | |||
| 144 | - | if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') }} | |||
| 145 | - | run: | | |||
| 146 | - | sudo apt-get update | |||
| 147 | - | sudo apt-get install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu qemu-user | |||
| 148 | - | go env -w CC=powerpc64le-linux-gnu-gcc | |||
| 149 | - | go env -w CXX=powerpc64le-linux-gnu-g++ | |||
| 150 | - | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |||
| 151 | - | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |||
| 152 | - | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |||
| 153 | - | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |||
| 154 | - | go env -u CC | |||
| 155 | - | go env -u CXX | |||
| 156 | - | ||||
| 157 | - | - name: go test (Linux riscv64) | |||
| 158 | - | if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') && !startsWith(matrix.go, '1.20.') && !startsWith(matrix.go, '1.21.') }} | |||
| 159 | - | run: | | |||
| 160 | - | sudo apt-get update | |||
| 161 | - | sudo apt-get install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user | |||
| 162 | - | go env -w CC=riscv64-linux-gnu-gcc | |||
| 163 | - | go env -w CXX=riscv64-linux-gnu-g++ | |||
| 164 | - | # Create symlink for the dynamic linker that QEMU expects | |||
| 165 | - | sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1 | |||
| 166 | - | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |||
| 167 | - | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |||
| 168 | - | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |||
| 169 | - | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |||
| 170 | - | go env -u CC | |||
| 171 | - | go env -u CXX | |||
| 172 | - | ||||
| 173 | - name: go test race (no Cgo) | 145 | - name: go test race (no Cgo) | ||
| 174 | if: ${{ runner.os == 'macOS' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }} | 146 | if: ${{ runner.os == 'macOS' && !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }} | ||
| 175 | run: | | 147 | run: | | ||
| @@ -181,26 +153,34 @@ jobs: | |||||
| 181 | run: | | 153 | run: | | ||
| 182 | env CGO_ENABLED=1 go test -race -shuffle=on -v -count=10 ./... | 154 | env CGO_ENABLED=1 go test -race -shuffle=on -v -count=10 ./... | ||
| 183 | 155 | ||||
| 184 | - | loong: | 156 | + | minor-arches: |
| 185 | strategy: | 157 | strategy: | ||
| 186 | matrix: | 158 | matrix: | ||
| 187 | - | # Loong64 support internal linking from go1.25. | 159 | + | # Test them only on the latest Go to reduce CI time. |
| 188 | - | go: ['1.25.x', '1.26.x'] | 160 | + | go: ['1.26.x'] |
| 189 | - | name: Test with Go ${{ matrix.go }} on Linux loong64 | 161 | + | name: Test with Go ${{ matrix.go }} on Linux minor architectures |
| 190 | runs-on: ubuntu-latest | 162 | runs-on: ubuntu-latest | ||
| 191 | defaults: | 163 | defaults: | ||
| 192 | run: | 164 | run: | ||
| 193 | shell: bash | 165 | shell: bash | ||
| 194 | steps: | 166 | steps: | ||
| 195 | - | - uses: actions/checkout@v5 | 167 | + | - name: Checkout |
| 168 | + | uses: actions/checkout@v5 | |||
| 169 | + | ||||
| 196 | - name: Setup Go | 170 | - name: Setup Go | ||
| 197 | uses: actions/setup-go@v6 | 171 | uses: actions/setup-go@v6 | ||
| 198 | with: | 172 | with: | ||
| 199 | go-version: ${{ matrix.go }} | 173 | go-version: ${{ matrix.go }} | ||
| 174 | + | ||||
| 200 | - name: Set up the prerequisites | 175 | - name: Set up the prerequisites | ||
| 201 | run: | | 176 | run: | | ||
| 202 | sudo apt-get update | 177 | sudo apt-get update | ||
| 203 | - | sudo apt-get install -y gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu qemu-user | 178 | + | sudo apt-get install -y \ |
| 179 | + | gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu \ | |||
| 180 | + | gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \ | |||
| 181 | + | gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \ | |||
| 182 | + | qemu-user | |||
| 183 | + | ||||
| 204 | - name: go test (Linux loong64) | 184 | - name: go test (Linux loong64) | ||
| 205 | run: | | 185 | run: | | ||
| 206 | go env -w CC=loongarch64-linux-gnu-gcc-14 | 186 | go env -w CC=loongarch64-linux-gnu-gcc-14 | ||
| @@ -212,6 +192,30 @@ jobs: | |||||
| 212 | go env -u CC | 192 | go env -u CC | ||
| 213 | go env -u CXX | 193 | go env -u CXX | ||
| 214 | 194 | ||||
| 195 | + | - name: go test (Linux ppc64le) | |||
| 196 | + | run: | | |||
| 197 | + | go env -w CC=powerpc64le-linux-gnu-gcc | |||
| 198 | + | go env -w CXX=powerpc64le-linux-gnu-g++ | |||
| 199 | + | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |||
| 200 | + | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |||
| 201 | + | env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |||
| 202 | + | env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |||
| 203 | + | go env -u CC | |||
| 204 | + | go env -u CXX | |||
| 205 | + | ||||
| 206 | + | - name: go test (Linux riscv64) | |||
| 207 | + | run: | | |||
| 208 | + | go env -w CC=riscv64-linux-gnu-gcc | |||
| 209 | + | go env -w CXX=riscv64-linux-gnu-g++ | |||
| 210 | + | # Create symlink for the dynamic linker that QEMU expects | |||
| 211 | + | sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1 | |||
| 212 | + | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo . | |||
| 213 | + | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10 | |||
| 214 | + | env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo . | |||
| 215 | + | env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10 | |||
| 216 | + | go env -u CC | |||
| 217 | + | go env -u CXX | |||
| 218 | + | ||||
| 215 | bsd: | 219 | bsd: | ||
| 216 | strategy: | 220 | strategy: | ||
| 217 | matrix: | 221 | matrix: | ||