File tree Expand file tree Collapse file tree 4 files changed +72
-2
lines changed Expand file tree Collapse file tree 4 files changed +72
-2
lines changed Original file line number Diff line number Diff line change 1+ name : CD
2+
3+ on :
4+ # Versioned Tags
5+ push :
6+ tags :
7+ - " v*.*.*"
8+
9+ jobs :
10+ # Build and test everything
11+ build :
12+ runs-on : ubuntu-latest
13+ steps :
14+ # Checkout the code
15+ - name : Checkout Code
16+ uses : actions/checkout@v2
17+
18+ # Set up the GoLang environment
19+ - name : Set up Go
20+ uses : actions/setup-go@v2
21+ with :
22+ go-version : 1.16
23+
24+ # Download all the tools used in the steps that follow
25+ - name : Set up Tools
26+ run : |
27+ go get -u github.com/mitchellh/gox
28+ go get -u golang.org/x/lint/golint
29+
30+ # Run all the unit-tests
31+ - name : Test
32+ run : |
33+ make test
34+
35+ # Build all the binaries for upload
36+ - name : Build Binaries
37+ run : |
38+ make dist
39+
40+ # Release binaries
41+ - name : Release
42+ uses : softprops/action-gh-release@v1
43+ with :
44+ files : |
45+ dist/go-sudoku*
Original file line number Diff line number Diff line change 22* .swp
33.coverprofile
44/.idea /
5+ /dist
56/go-sudoku
67/go-sudoku.exe
Original file line number Diff line number Diff line change 1- .PHONY : all test
1+ .PHONY : all test dist
2+
3+ TOOLS := github.com/mitchellh/
[email protected] \ 4+ golang.org/x/lint/golint \
5+
6+ VERSION ?= dev
7+ ifdef GITHUB_REF_NAME
8+ VERSION = $(GITHUB_REF_NAME )
9+ endif
10+
211
312default : run
413
@@ -15,7 +24,14 @@ demo-generate: build
1524demo-solve : build
1625 ./go-sudoku -format csv generate | ./go-sudoku -progress solve
1726
18- fmt :
27+ dist :
28+ gox -ldflags=" -s -w -X main.version=${VERSION} " \
29+ -os=" linux darwin windows" \
30+ -arch=" amd64" \
31+ -output=" ./dist/{{.Dir}}_{{.OS}}_{{.Arch}}" \
32+ .
33+
34+ fmt : tidy
1935 go fmt $(shell go list ./...)
2036
2137gen : gen-readme
3248test : gen fmt lint vet build
3349 go test -cover -coverprofile=.coverprofile $(shell go list ./...)
3450
51+ tidy :
52+ go mod tidy
53+
3554vet :
3655 go vet $(shell go list ./...)
3756
Original file line number Diff line number Diff line change 4949 flagSeed = flag .Int64 ("seed" , 0 , "RNG Seed (0 => random number based on time) [$SEED]" )
5050 flagTheme = flag .String ("theme" , "none" , "Table formatting theme (" + themes + ")" )
5151 flagType = flag .String ("type" , "default" , "Sudoku Type (" + types + ")" )
52+
53+ // version
54+ version = "dev"
5255)
5356
5457func main () {
@@ -257,6 +260,8 @@ func printHelp() {
257260
258261Usage: go-sudoku [flags] <action>
259262
263+ Version: ` + version + `
264+
260265Actions:
261266--------
262267 * generate: Generate a Sudoku Grid and apply the specified difficulty on it
You can’t perform that action at this time.
0 commit comments