From d6dc5b0bb557c60f92cec8c0b513638cefc7396c Mon Sep 17 00:00:00 2001 From: Daniel Eje Date: Sun, 13 Nov 2022 19:30:42 +0100 Subject: [PATCH 1/5] fix frontend build for windows --- Makefile | 5 ++++- web/package.json | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7599f7b..ef5965f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ version=fake ifeq ($(OS),Windows_NT) bin=main.exe +export=set else bin=main +export=export endif # Example: # make @@ -40,6 +42,7 @@ endif dependencies: ifeq ($(bin),main.exe) @make prep-ci-local-windows + yarn add react-scripts@latest else @make prep-ci-local endif @@ -48,7 +51,7 @@ endif .PHONY: build-frontend build-frontend: - cd web && yarn build && cd .. + cd web && $(export) BUILD_PATH=../cmd/build && CI=false yarn build && cd .. .PHONY: serve-backend serve-backend: diff --git a/web/package.json b/web/package.json index 57da766..f9ebc0c 100644 --- a/web/package.json +++ b/web/package.json @@ -28,7 +28,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "BUILD_PATH='../cmd/build' react-scripts build", + "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, @@ -50,4 +50,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file From e53a25fd1c1b343660bb38dbc841f8d5da7d66a7 Mon Sep 17 00:00:00 2001 From: Daniel Eje Date: Sun, 13 Nov 2022 19:30:57 +0100 Subject: [PATCH 2/5] setup goreleaser --- .github/workflows/release.yaml | 28 ++++++++++++++++++++++++ .goreleaser.yaml | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4865f37 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,28 @@ +name: goreleaser +on: + push: + branches: [main,feature/test-goreleaser] + tags: + - 'v*' +jobs: + goreleaser: + runs-on: ubuntu-latest + if: success() && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.3' + cache: true + - run: make dependencies + - run: make build-frontend + - uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..48532d2 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,39 @@ +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^intergration:' + - '^assets:' +nfpms: +- maintainer: Bisohns Corp. + description: YAML based tool for monitoring metrics across multiple hosts + homepage: https://github.com/bisohns/saido + license: Apache License 2.0 + formats: + - deb + - rpm + - apk \ No newline at end of file From 2c24170e9375ba2c569e76b5f7dfb24f162c3c53 Mon Sep 17 00:00:00 2001 From: Daniel Eje Date: Sun, 13 Nov 2022 19:31:31 +0100 Subject: [PATCH 3/5] add builds to tests --- .github/workflows/release.yaml | 2 +- .github/workflows/test-macos.yml | 15 ++++++++++----- .github/workflows/test-ssh.yml | 15 ++++++++++----- .github/workflows/test-windows.yml | 15 ++++++++++----- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4865f37..ebb5908 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,7 +1,7 @@ name: goreleaser on: push: - branches: [main,feature/test-goreleaser] + branches: [main] tags: - 'v*' jobs: diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 86a2ec3..3cc6e59 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -1,8 +1,8 @@ on: push: - branches: [ main, develop ] + branches: [ main, develop] pull_request: - branches: [ main ] + branches: [ main] name: Test-MacOs jobs: test: @@ -11,11 +11,16 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: '>=1.16' - name: Checkout code uses: actions/checkout@v2 - name: Setup config script # using locals for mac-OS because github CI mac platforms don't have docker - run: make prep-ci-local + run: | + make prep-ci-local + make dependencies + make build-frontend - name: Test - run: go test -v ./... + run: | + go mod tidy + go test -v ./... diff --git a/.github/workflows/test-ssh.yml b/.github/workflows/test-ssh.yml index eb354fa..2590a37 100644 --- a/.github/workflows/test-ssh.yml +++ b/.github/workflows/test-ssh.yml @@ -1,8 +1,8 @@ on: push: - branches: [ main, develop ] + branches: [ main, develop] pull_request: - branches: [ main ] + branches: [ main] name: Test-Linux jobs: test: @@ -11,11 +11,16 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: '>=1.16' - name: Checkout code uses: actions/checkout@v2 - name: Setup SSH server and config # run docker ssh container for ssh tests - run: make prep-ci-ssh + run: | + make prep-ci-ssh + make dependencies + make build-frontend - name: Test - run: go test -v ./... + run: | + go mod tidy + go test -v ./... diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 5001d66..ec17739 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -1,8 +1,8 @@ on: push: - branches: [ main, develop ] + branches: [ main, develop] pull_request: - branches: [ main ] + branches: [ main] name: Test-Windows jobs: test: @@ -11,7 +11,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: '>=1.16' - name: Checkout code uses: actions/checkout@v2 - name: Choco Install make @@ -20,6 +20,11 @@ jobs: args: install make - name: Setup config script # using locals for Windows because github CI Windows platforms don't have docker - run: make prep-ci-local-windows + run: | + make prep-ci-local-windows + make dependencies + make build-frontend - name: Test - run: go test -v ./... + run: | + go mod tidy + go test -v ./... From 44f5cb95442b5cfc33f0c099d38f1526323f0be4 Mon Sep 17 00:00:00 2001 From: Deven96 Date: Mon, 14 Nov 2022 15:13:38 +0100 Subject: [PATCH 4/5] Removing snapshot --- .goreleaser.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 48532d2..1d0255c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -18,8 +18,8 @@ archives: amd64: x86_64 checksum: name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" +#snapshot: +# name_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: @@ -36,4 +36,4 @@ nfpms: formats: - deb - rpm - - apk \ No newline at end of file + - apk From 5712edcf02c51e631df7ba66cd6b81afbd46e179 Mon Sep 17 00:00:00 2001 From: Daniel Eje Date: Mon, 14 Nov 2022 15:43:48 +0100 Subject: [PATCH 5/5] hotfix windows build --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ef5965f..1f0c1eb 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,8 @@ version=fake ifeq ($(OS),Windows_NT) bin=main.exe -export=set else bin=main -export=export endif # Example: # make @@ -51,7 +49,7 @@ endif .PHONY: build-frontend build-frontend: - cd web && $(export) BUILD_PATH=../cmd/build && CI=false yarn build && cd .. + cd web && export BUILD_PATH=../cmd/build && CI=false yarn build && cd .. .PHONY: serve-backend serve-backend: