Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/test goreleaser #24

Merged
merged 4 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: goreleaser
on:
push:
branches: [main]
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 }}

15 changes: 10 additions & 5 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-MacOs
jobs:
test:
Expand All @@ -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 ./...
15 changes: 10 additions & 5 deletions .github/workflows/test-ssh.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-Linux
jobs:
test:
Expand All @@ -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 ./...
15 changes: 10 additions & 5 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-Windows
jobs:
test:
Expand All @@ -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
Expand All @@ -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 ./...
39 changes: 39 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version=fake
ifeq ($(OS),Windows_NT)
bin=main.exe
export=set
else
bin=main
export=export
endif
# Example:
# make
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -50,4 +50,4 @@
"last 1 safari version"
]
}
}
}