File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # This workflow will build a golang project
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3-
1+ # .github/workflows/go.yml
42name : Go
53
64on :
108 branches : [ "main" ]
119
1210jobs :
13-
1411 build :
1512 runs-on : ubuntu-latest
1613 steps :
17- - uses : actions/checkout@v4
14+ - uses : actions/checkout@v4
15+
16+ - name : Set up Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version : ' 1.20'
1820
19- - name : Set up Go
20- uses : actions/setup-go@v4
21- with :
22- go-version : ' 1.20'
21+ - name : Test (Linux host)
22+ run : go test -v ./...
2323
24- - name : Build
25- run : go build -v ./...
24+ - name : Build Windows .exe (cross-compile)
25+ run : |
26+ mkdir -p dist
27+ GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -v -o dist/app.exe ./app
2628
27- - name : Test
28- run : go test -v ./...
29+ - name : Upload Windows artifact
30+ uses : actions/upload-artifact@v4
31+ with :
32+ name : app-windows-amd64.exe
33+ path : dist/app.exe
You can’t perform that action at this time.
0 commit comments