Skip to content

Commit

Permalink
ci: better build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Feb 27, 2024
1 parent 41e3571 commit 092e535
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64 }

- { goos: linux, goarch: '386', output: '386' }
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible }
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible, test: test }
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64 }
- { goos: linux, goarch: arm64, output: arm64 }
- { goos: linux, goarch: arm, goarm: '7', output: armv7 }
Expand Down Expand Up @@ -62,32 +62,35 @@ jobs:
- { goos: android, goarch: arm, ndk: armv7a-linux-androideabi34, output: armv7 }
- { goos: android, goarch: arm64, ndk: aarch64-linux-android34, output: arm64-v8 }

- { goos: windows, goarch: '386', output: '386-go120', version: 20 }
- { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
- { goos: windows, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
# Go 1.20 is the last release that will run on any release of Windows 7, 8, Server 2008 and Server 2012. Go 1.21 will require at least Windows 10 or Server 2016.
- { goos: windows, goarch: '386', output: '386-go120', goversion: '1.20' }
- { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20' }
- { goos: windows, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }

- { goos: darwin, goarch: arm64, output: arm64-go120, version: 20 }
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
# Go 1.20 is the last release that will run on macOS 10.13 High Sierra or 10.14 Mojave. Go 1.21 will require macOS 10.15 Catalina or later.
- { goos: darwin, goarch: arm64, output: arm64-go120, goversion: '1.20' }
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20' }
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }

- { goos: linux, goarch: '386', output: '386-go120', version: 20 }
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
# only for test
- { goos: linux, goarch: '386', output: '386-go120', goversion: '1.20' }
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20', test: test }
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }

steps:
- uses: actions/checkout@v4

- name: Set up Go1.22
if: ${{ matrix.jobs.version != '20' && matrix.jobs.goarch != 'loong64' }}
- name: Set up Go
if: ${{ matrix.jobs.goversion == '' && matrix.jobs.goarch != 'loong64' }}
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Set up Go1.20
if: ${{ matrix.jobs.version == '20' && matrix.jobs.goarch != 'loong64' }}
- name: Set up Go
if: ${{ matrix.jobs.goversion != '' && matrix.jobs.goarch != 'loong64' }}
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ matrix.jobs.goversion }}

- name: Set up Go1.21 loongarch abi1
if: ${{ matrix.jobs.goarch == 'loong64' && matrix.jobs.abi == '1' }}
Expand Down Expand Up @@ -135,7 +138,12 @@ jobs:
echo "CGO_ENABLED=1" >> $GITHUB_ENV
echo "BUILDTAG=" >> $GITHUB_ENV
- name: build core
- name: Test
if: ${{ matrix.jobs.test == 'test' }}
run: |
go test ./...
- name: Build core
env:
GOOS: ${{matrix.jobs.goos}}
GOARCH: ${{matrix.jobs.goarch}}
Expand Down

0 comments on commit 092e535

Please sign in to comment.