Skip to content

Commit

Permalink
Merge pull request #592 from gotify/build
Browse files Browse the repository at this point in the history
Build
  • Loading branch information
jmattheis committed Sep 17, 2023
2 parents 8c0f7a9 + 101c542 commit 97f180b
Show file tree
Hide file tree
Showing 19 changed files with 988 additions and 1,015 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Expand Up @@ -7,10 +7,10 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '20'
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand All @@ -28,7 +28,7 @@ jobs:
- run: make build-js
- uses: golangci/golangci-lint-action@v3
with:
version: v1.45
version: v1.53
args: --timeout=5m
skip-cache: true
- run: go mod download
Expand Down
4 changes: 0 additions & 4 deletions .golangci.yml
Expand Up @@ -6,8 +6,6 @@ run:
linters:
enable:
- asciicheck
- deadcode
- depguard
- exportloopref
- godot
- gofmt
Expand All @@ -23,12 +21,10 @@ linters:
- nolintlint
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
disable:
- goerr113
Expand Down
2 changes: 1 addition & 1 deletion GO_VERSION
@@ -1 +1 @@
1.19.1
1.21.1
12 changes: 5 additions & 7 deletions Makefile
Expand Up @@ -7,20 +7,18 @@ DOCKER_BUILD_IMAGE=gotify/build
DOCKER_WORKDIR=/proj
DOCKER_RUN=docker run --rm -v "$$PWD/.:${DOCKER_WORKDIR}" -v "`go env GOPATH`/pkg/mod/.:/go/pkg/mod:ro" -w ${DOCKER_WORKDIR}
DOCKER_GO_BUILD=go build -mod=readonly -a -installsuffix cgo -ldflags "$$LD_FLAGS"
NODE_OPTIONS=$(shell if node --help | grep -q -- "--openssl-legacy-provider"; then echo --openssl-legacy-provider; fi)

test: test-coverage test-race test-js
test: test-coverage test-js
check: check-go check-swagger check-js
check-ci: check-swagger check-js

require-version:
if [ -n ${VERSION} ] && [[ $$VERSION == "v"* ]]; then echo "The version may not start with v" && exit 1; fi
if [ -z ${VERSION} ]; then echo "Need to set VERSION" && exit 1; fi;

test-race:
go test -race ./...

test-coverage:
go test -coverprofile=coverage.txt -covermode=atomic ./...
go test --race -coverprofile=coverage.txt -covermode=atomic ./...

format:
goimports -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
Expand All @@ -38,7 +36,7 @@ check-js:
(cd ui && yarn testformat)

download-tools:
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.26.1
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5

update-swagger:
swagger generate spec --scan-models -o docs/spec.json
Expand Down Expand Up @@ -124,7 +122,7 @@ build-docker-riscv64: require-version
build-docker: build-docker-amd64 build-docker-arm-7 build-docker-arm64 build-docker-riscv64

build-js:
(cd ui && yarn build)
(cd ui && NODE_OPTIONS="${NODE_OPTIONS}" yarn build)

build-linux-amd64:
${DOCKER_RUN} ${DOCKER_BUILD_IMAGE}:$(GO_VERSION)-linux-amd64 ${DOCKER_GO_BUILD} -o ${BUILD_DIR}/gotify-linux-amd64 ${DOCKER_WORKDIR}
Expand Down

0 comments on commit 97f180b

Please sign in to comment.