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
137 changes: 31 additions & 106 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,111 +17,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

test-postgresql-windows:
if: true # false to skip job during debug
name: Test on Windows
runs-on: windows-latest
steps:

- name: Start PostgreSQL on Windows
run: |
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru

- name: Create scheduler user on Windows
run: |
& $env:PGBIN\psql --command="CREATE USER scheduler PASSWORD 'somestrong'" --command="\du"

- name: Create timetable database
run: |
& $env:PGBIN\createdb --owner=scheduler timetable
$env:PGPASSWORD = 'somestrong'
& $env:PGBIN\psql --username=scheduler --host=localhost --list timetable

- name: Check out code
uses: actions/checkout@v5

- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'

- name: Test
run: go test -v -p 1 -parallel 1 -failfast ./...



test-postgresql-macos:
if: true # false to skip job during debug
name: Test on MacOS
runs-on: macos-latest
steps:

- name: Start PostgreSQL on MacOS
run: |
brew update
brew install postgresql@16
brew link --force postgresql@16
brew services start postgresql@16
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [ $i -gt 0 ]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done

# Homebrew creates an account with the same name as the installing user, but no password
- name: Create scheduler user
run: |
psql --command="CREATE USER scheduler PASSWORD 'somestrong'" --command="\du" postgres

- name: Create timetable database
run: |
createdb --owner=scheduler timetable
PGPASSWORD=somestrong psql --username=scheduler --host=localhost --list timetable
# This workflow uses testcontainers-go for PostgreSQL testing
# Docker provides consistent environment - only Ubuntu needed

- name: Check out code
uses: actions/checkout@v5

- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'

- name: Test
run: go test -v -p 1 -parallel 1 -failfast ./...
jobs:

test-postgresql-ubuntu:
test:
if: true # false to skip job during debug
name: Test and Build on Ubuntu
name: Test and Build with Testcontainers
runs-on: ubuntu-latest
steps:

- name: Start PostgreSQL on Ubuntu
run: |
sudo systemctl start postgresql.service
pg_isready

- name: Create scheduler user
run: |
sudo -u postgres psql --command="CREATE USER scheduler PASSWORD 'somestrong'" --command="\du"

- name: Create timetable database
run: |
sudo -u postgres createdb --owner=scheduler timetable
PGPASSWORD=somestrong psql --username=scheduler --host=localhost --list timetable

- name: Check out code
uses: actions/checkout@v5

Expand All @@ -140,23 +46,42 @@ jobs:
with:
version: latest

- name: Test
run: go test -failfast -v -timeout=300s -p 1 -coverprofile=profile.cov ./...
- name: Test with Testcontainers
run: go test -failfast -v -timeout=300s -coverprofile=profile.cov ./...

- name: Coveralls
uses: shogo82148/actions-goveralls@v1
- name: Upload coverage profile
uses: actions/upload-artifact@v4
with:
path-to-profile: profile.cov
name: coverage-profile-${{ github.run_id }}
path: profile.cov
retention-days: 1

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --snapshot --skip=publish --clean

coverage:
if: true # false to skip job during debug
name: Coverage Report
runs-on: ubuntu-latest
needs: [test]
steps:

- name: Download coverage profile
uses: actions/download-artifact@v4
with:
name: coverage-profile-${{ github.run_id }}

- name: Send coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
file: profile.cov

build-docs:
if: true # false to skip job during debug
needs: [test-postgresql-ubuntu, test-postgresql-windows, test-postgresql-macos]
needs: [test]
name: Build Docs
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -201,7 +126,7 @@ jobs:

test-docker-images:
if: true # false to skip job during debug
needs: [test-postgresql-ubuntu, test-postgresql-windows, test-postgresql-macos]
needs: [test]
name: Test Docker Image Build
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"files.eol": "\n"
"files.eol": "\n",
"terminal.integrated.defaultProfile.windows": "PowerShell"
}
47 changes: 47 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,76 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
github.com/testcontainers/testcontainers-go v0.39.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.39.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v28.4.0+incompatible // indirect
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.9.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/shirou/gopsutil/v4 v4.25.8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
google.golang.org/grpc v1.75.0 // indirect
google.golang.org/protobuf v1.36.7 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading