Skip to content

Commit

Permalink
up test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lejianwen committed Sep 22, 2024
1 parent d4623c5 commit f9edcb9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ jobs:
with:
go-version: '1.22' # 选择 Go 版本
- name: install gcc zip
run: sudo apt-get install gcc-mingw-w64-x86-64 zip -y
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then
sudo apt-get install gcc-mingw-w64-x86-64 zip -y
fi
- name: tidy
run: go mod tidy
Expand All @@ -48,11 +51,10 @@ jobs:
mkdir -p release/runtime
if [ "${{ matrix.goos }}" = "windows" ]; then
CC=x86_64-w64-mingw32-gcc GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -o ./release/apimain.exe ./cmd/apimain.go
cd release
zip -r ../${{ matrix.goos}}-${{ matrix.goarch }}.zip .
zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
else
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz -C ./release .
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release
fi
- name: Upload artifact
Expand Down

0 comments on commit f9edcb9

Please sign in to comment.