Skip to content
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
14 changes: 7 additions & 7 deletions .github/workflows/prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

- name: Run Pre-Commit
uses: pre-commit/action@v2.0.3
uses: pre-commit/action@v3.0.1

build:
name: Build
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Set up Go 1.23.1
uses: actions/setup-go@v2
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23.1
go-version: 1.23
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build Binary
run: go build -v .
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: linux-amd64
- goos: linux
goarch: arm64
suffix: linux-arm64
- goos: linux
goarch: arm
suffix: linux-arm
- goos: linux
goarch: "386"
suffix: linux-386
- goos: darwin
goarch: amd64
suffix: darwin-amd64
- goos: darwin
goarch: arm64
suffix: darwin-arm64
- goos: windows
goarch: amd64
suffix: windows-amd64.exe
- goos: windows
goarch: "386"
suffix: windows-386.exe

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -v \
-ldflags="-s -w -X main.version=${{ github.ref_name }}" \
-o checkup-${{ github.ref_name }}-${{ matrix.suffix }} \
main.go

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: checkup-${{ github.ref_name }}-${{ matrix.suffix }}
path: checkup-${{ github.ref_name }}-${{ matrix.suffix }}

publish:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
generate_release_notes: true
files: dist/*
5 changes: 2 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build run compile build-linux build-windows build-darwin test

VERSION ?= 0.7.0
VERSION ?= 0.8.0
NAME ?= "checkup"

test:
Expand All @@ -15,8 +15,7 @@ run:
build-darwin:
echo "Compiling for Darwin"
GOOS=darwin GOARCH=amd64 go build -o release/$(NAME)-v${VERSION}-darwin-amd64 main.go
# GOOS=darwin GOARCH=arm go build -v -o release/$(NAME)-v${VERSION}-darwin-arm main.go
# GOOS=darwin GOARCH=arm64 go build -o release/$(NAME)-v${VERSION}-darwin-arm64 main.go
GOOS=darwin GOARCH=arm64 go build -o release/$(NAME)-v${VERSION}-darwin-arm64 main.go

build-windows:
echo "Compiling for Windows"
Expand Down
4 changes: 2 additions & 2 deletions utils/ReadExam.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package utils
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand All @@ -23,7 +23,7 @@ type ExamFile struct {
// ReadExam ... Help read a given file and set to a struct
func ReadExam(file string) ExamFile {
var exam ExamFile
examFile, err := ioutil.ReadFile(file)
examFile, err := os.ReadFile(file)
ErrorCheck(err)
extension := filepath.Ext(strings.TrimSpace(file))
err = fmt.Errorf("wrong Extension: %v", extension)
Expand Down
4 changes: 2 additions & 2 deletions utils/checkup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type CheckupResults struct {
Endpoint string
Code int
Result int
Lantency time.Duration
Latency time.Duration
Pass bool
}

Expand Down Expand Up @@ -50,7 +50,7 @@ func Checkup(healthForm CheckupRequest) CheckupResults {
Endpoint: healthForm.Endpoint,
Code: healthForm.Code,
Result: resp.StatusCode,
Lantency: end,
Latency: end,
Pass: resp.StatusCode == healthForm.Code,
}

Expand Down
2 changes: 1 addition & 1 deletion utils/styledOutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Show(checkups []CheckupResults) *table.Table {
checkups[count].Endpoint,
strconv.Itoa(checkups[count].Code),
strconv.Itoa(checkups[count].Result),
strconv.FormatInt(checkups[count].Lantency.Milliseconds(), 10),
strconv.FormatInt(checkups[count].Latency.Milliseconds(), 10),
strconv.FormatBool(checkups[count].Pass),
)
}
Expand Down
Loading