build(ci): use goreleaser only

This commit is contained in:
criyle 2025-01-25 20:25:19 -05:00
parent 5ab4510877
commit 17878d722f
2 changed files with 71 additions and 138 deletions

View File

@ -46,140 +46,8 @@ jobs:
distribution: goreleaser
version: latest
args: release --snapshot --clean
build:
name: Build-${{ matrix.os }}-${{ matrix.GOARCH }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
GOARCH:
- amd64
include:
- os: ubuntu-latest
GOARCH: "386"
- os: ubuntu-latest
GOARCH: "arm"
- os: ubuntu-latest
GOARCH: "arm64"
- os: ubuntu-latest
GOARCH: "riscv64"
- os: macos-latest
GOARCH: "arm64"
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Get git tag ref
run: git fetch --prune --unshallow --tags
- name: Download dependencies
run: go mod download
- name: Generate version
run: go generate ./cmd/go-judge/version
- name: Build on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLE: 0
run: |
go build -v -tags grpcnotrace,nomsgpack -o go-judge ./cmd/go-judge
go build -v -o go-judge-shell ./cmd/go-judge-shell
go build -o go-judge-init ./cmd/go-judge-init
- name: Build shared objects on Linux
if: ${{ matrix.os == 'ubuntu-latest' && matrix.GOARCH == 'amd64' }}
env:
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLE: 1
run: |
go build -buildmode=c-shared -o go-judge.so ./cmd/go-judge-ffi
- name: Upload go-judge on linux
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: go-judge-${{ matrix.GOARCH }}
path: go-judge
- name: Upload go-judge-shell on linux
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-shell-${{ matrix.GOARCH }}
path: go-judge-shell
- name: Upload go-judge-init on linux
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-init-${{ matrix.GOARCH }}
path: go-judge-init
- name: Upload go-judge.so on linux
if: ${{ matrix.os == 'ubuntu-latest' && matrix.GOARCH == 'amd64' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-${{ matrix.GOARCH }}.so
path: go-judge.so
- name: Build on Windows
if: ${{ matrix.os == 'windows-latest' }}
env:
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLE: 0
run: |
go build -tags grpcnotrace,nomsgpack -o go-judge.exe ./cmd/go-judge
- name: Build shared object on Windows
if: ${{ matrix.os == 'windows-latest' }}
env:
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLE: 1
run: |
go build -buildmode=c-shared -o go-judge.dll ./cmd/go-judge-ffi
- name: Upload go-judge.exe on Windows
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-${{ matrix.GOARCH }}.exe
path: go-judge.exe
- name: Upload go-judge.dll on Windows
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-${{ matrix.GOARCH }}.dll
path: go-judge.dll
- name: Build on macOS
if: ${{ matrix.os == 'macos-latest' }}
env:
GOARCH: ${{ matrix.GOARCH }}
CGO_ENABLE: 0
run: |
go build -tags grpcnotrace,nomsgpack -o go-judge ./cmd/go-judge
go build -o go-judge-shell ./cmd/go-judge-shell
# - name: Build shared object on macOS
# if: ${{ matrix.os == 'macos-latest' && matrix.GOARCH == 'amd64' }}
# env:
# GOARCH: ${{ matrix.GOARCH }}
# CGO_ENABLE: 1
# run: |
# go build -buildmode=c-shared -o go-judge.dylib ./cmd/go-judge-ffi
- name: Upload go-judge on macOS
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-MacOS-${{ matrix.GOARCH }}
path: go-judge
- name: Upload go-judge-shell on macOS
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v4
with:
name: go-judge-shell-MacOS-${{ matrix.GOARCH }}
path: go-judge-shell
# - name: Upload go-judge.dylib on macOS
# if: ${{ matrix.os == 'macos-latest' && matrix.GOARCH == 'amd64' }}
# uses: actions/upload-artifact@v4
# with:
# name: go-judge-${{ matrix.GOARCH }}.dylib
# path: go-judge.dylib
name: go-judge
path: dist/*

View File

@ -10,7 +10,9 @@ before:
# you may remove this if you don't need go generate
- go generate ./cmd/...
builds:
- env:
- main: ./cmd/go-judge
binary: go-judge
env:
- CGO_ENABLED=0
goos:
- linux
@ -37,8 +39,71 @@ builds:
tags:
- nomsgpack
- grpcnotrace
main: ./cmd/go-judge
binary: go-judge
- main: ./cmd/go-judge-shell
binary: go-judge-shell
id: go-judge-shell
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- "386"
- amd64
- arm
- arm64
- riscv64
- loong64
- mips64le
- ppc64le
- s390x
goarm:
- "5"
- "7"
goarm64:
- "v8.0"
goamd64:
- v2
- v3
tags:
- nomsgpack
- grpcnotrace
- main: ./cmd/go-judge-ffi
binary: go-judge-ffi
id: go-judge-ffi
buildmode: c-shared
goos:
- linux
goarch:
- amd64
goamd64:
- v2
- main: ./cmd/go-judge-init
binary: go-judge-init
id: go-judge-init
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- "386"
- amd64
- arm
- arm64
- riscv64
- loong64
- mips64le
- ppc64le
- s390x
goarm:
- "5"
- "7"
goarm64:
- "v8.0"
goamd64:
- v2
- v3
archives:
- files:
- mount.yaml