Skip to content

Commit

Permalink
Merge pull request #1 from davidmasek/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
davidmasek authored Dec 9, 2024
2 parents 6a57c44 + 82111c3 commit 7df46e1
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 24 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ If you want to use Beacon you currently have to run, host and potentially (gasp)
- this is an inconvenience for potential users
- 🔴 notifications
- currently needs updates after refactors of other parts


- 🟡 dev workflow
- 🟢 basic github setup
- want CI for building/testing
- 🟡 testing
- 🟢 unit tests for storage
- want at least one end-to-end test
- want more automation, related to "dev workflow"


## 🚀 Run
Expand Down
4 changes: 2 additions & 2 deletions cmd/monitor/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package main
import (
"fmt"

"github.com/davidmasek/beacon/monitor"
"github.com/davidmasek/beacon/storage"
"github.com/spf13/viper"
"optimisticotter.me/heartbeat-monitor/monitor"
"optimisticotter.me/heartbeat-monitor/storage"
)

func main() {
Expand Down
14 changes: 5 additions & 9 deletions cmd/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"log"
"time"

"github.com/davidmasek/beacon/handlers"
"github.com/davidmasek/beacon/monitor"
"github.com/davidmasek/beacon/status"
"github.com/davidmasek/beacon/storage"
"github.com/spf13/viper"
"optimisticotter.me/heartbeat-monitor/handlers"
"optimisticotter.me/heartbeat-monitor/monitor"
"optimisticotter.me/heartbeat-monitor/status"
"optimisticotter.me/heartbeat-monitor/storage"
)

func main() {
Expand Down Expand Up @@ -75,11 +75,7 @@ func main() {
log.Println("[ERROR]", err)
continue
}
timestamps := make([]time.Time, 0)
if healthCheck != nil {
timestamps = append(timestamps, healthCheck.Timestamp)
}
serviceStatus, err := config.GetServiceStatus(timestamps)
serviceStatus, err := config.GetServiceStatus(healthCheck)
if err != nil {
log.Println("[ERROR]", err)
continue
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

_ "github.com/mattn/go-sqlite3"

"optimisticotter.me/heartbeat-monitor/monitor"
"optimisticotter.me/heartbeat-monitor/status"
"optimisticotter.me/heartbeat-monitor/storage"
"github.com/davidmasek/beacon/monitor"
"github.com/davidmasek/beacon/status"
"github.com/davidmasek/beacon/storage"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions handlers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"fmt"

"optimisticotter.me/heartbeat-monitor/monitor"
"optimisticotter.me/heartbeat-monitor/storage"
"github.com/davidmasek/beacon/monitor"
"github.com/davidmasek/beacon/storage"
)

type ServiceReport struct {
Expand Down
2 changes: 1 addition & 1 deletion handlers/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"optimisticotter.me/heartbeat-monitor/monitor"
"github.com/davidmasek/beacon/monitor"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion monitor/heartbeat_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
_ "github.com/mattn/go-sqlite3"
"github.com/spf13/viper"

"optimisticotter.me/heartbeat-monitor/storage"
"github.com/davidmasek/beacon/storage"
)

type HeartbeatListener struct {
Expand Down
2 changes: 1 addition & 1 deletion monitor/monitor.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package monitor

import (
"github.com/davidmasek/beacon/storage"
"github.com/spf13/viper"
"optimisticotter.me/heartbeat-monitor/storage"
)

type Monitor interface {
Expand Down
2 changes: 1 addition & 1 deletion monitor/web_pinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"slices"
"strings"

"github.com/davidmasek/beacon/storage"
"github.com/spf13/viper"
"optimisticotter.me/heartbeat-monitor/storage"
)

type WebPinger struct {
Expand Down
4 changes: 2 additions & 2 deletions status/ui_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sort"
"time"

"optimisticotter.me/heartbeat-monitor/monitor"
"optimisticotter.me/heartbeat-monitor/storage"
"github.com/davidmasek/beacon/monitor"
"github.com/davidmasek/beacon/storage"
)

type HeartbeatConfig struct {
Expand Down

0 comments on commit 7df46e1

Please sign in to comment.