Commit Graph

36 Commits

Author SHA1 Message Date
Houmgaor
d2e35c3be3 fix(ci): exclude Docker build artifact from release download
download-artifact picked up the Docker build provenance artifact
(Mezeporta~Erupe~39YWA8.dockerbuild) which fails to extract after
5 retries. Filter to only *-amd64 artifacts.
2026-03-19 15:57:51 +01:00
Houmgaor
24428c8409 fix(ci): remove www/ copy from release archive
www/ contains only a gitignored jp/ subdirectory with dev notes.
The directory is absent in CI, causing cp to fail on release builds.
2026-03-19 15:52:19 +01:00
Houmgaor
ecfe58ffb4 feat: add SQLite support, setup wizard enhancements, and live dashboard
Add zero-dependency SQLite mode so users can run Erupe without
PostgreSQL. A transparent db.DB wrapper auto-translates PostgreSQL
SQL ($N placeholders, now(), ::casts, ILIKE, public. prefix,
TRUNCATE) for SQLite at runtime — all 28 repo files use the wrapper
with no per-query changes needed.

Setup wizard gains two new steps: quest file detection with download
link, and gameplay presets (solo/small/community/rebalanced). The API
server gets a /dashboard endpoint with auto-refreshing stats.

CI release workflow now builds and pushes Docker images to GHCR
alongside binary artifacts on tag push.

Key changes:
- common/db: DB/Tx wrapper with 6 SQL translation rules
- server/migrations/sqlite: full SQLite schema (0001-0005)
- config: Database.Driver field ("postgres" or "sqlite")
- main.go: SQLite connection with WAL mode, single writer
- server/setup: quest check + preset selection steps
- server/api: /dashboard with live stats
- .github/workflows: Docker in release, deduplicate docker.yml
2026-03-05 18:00:30 +01:00
Houmgaor
7e24bbc087 ci: serialize test packages to fix shared database race condition
The migrations and channelserver packages both DROP and recreate the
public schema on the shared erupe_test database. With parallel package
execution, they destroy each other's schema mid-migration. Adding -p 1
serializes package execution while preserving t.Parallel() within each
package.
2026-02-27 13:28:45 +01:00
Houmgaor
f9d4252860 test(repos): add SQL integration tests for 17 untested repo files
Add 148 integration tests exercising actual SQL against PostgreSQL for
all previously untested repository files. Includes 6 new fixture helpers
in testhelpers_db.go and CI PostgreSQL service configuration.

Discovered and documented existing RecordPurchase SQL bug (ambiguous
column reference in ON CONFLICT clause).
2026-02-24 16:57:47 +01:00
Houmgaor
385b974adc feat(config): register all defaults in code, shrink example config
Only the database password is truly mandatory to get started, but
config.example.json was 267 lines with 90+ options. Newcomers faced a
wall of settings with no indication of what matters.

Add registerDefaults() with all sane defaults via Viper so a minimal
config (just DB credentials) produces a fully working server. Gameplay
multipliers default to 1.0 instead of Go's zero value 0.0, which
previously zeroed out all quest rewards for minimal configs. Uses
dot-notation defaults for GameplayOptions/DebugOptions so users can
override individual fields without losing other defaults.

- Shrink config.example.json from 267 to 10 lines
- Rename full original to config.reference.json as documentation
- Simplify wizard buildDefaultConfig() from ~220 to ~12 lines
- Fix latent bug: SaveDumps default used wrong key DevModeOptions
- Add tests: minimal config, backward compat, single-field override
- Update release workflow, README, CONTRIBUTING, docker/README
2026-02-23 21:25:44 +01:00
Houmgaor
27fb0faa1e feat(db): add embedded auto-migrating schema system
Replace 4 independent schema management code paths (Docker shell
script, setup wizard pg_restore, test helpers, manual psql) with a
single migration runner embedded in the server binary.

The new server/migrations/ package uses Go embed to bundle all SQL
schemas. On startup, Migrate() creates a schema_version tracking
table, detects existing databases (auto-marks baseline as applied),
and runs pending migrations in transactions.

Key changes:
- Consolidated init.sql + 9.2-update + 33 patches into 0001_init.sql
- Setup wizard simplified to single "Apply schema" checkbox
- Test helpers use migrations.Migrate() instead of pg_restore
- Docker no longer needs schema volume mounts or init script
- Seed data (shops, events, gacha) embedded and applied via API
- Future migrations just add 0002_*.sql files — no manual steps
2026-02-23 21:19:21 +01:00
Houmgaor
12f463e03b ci: replace codecov with local coverage threshold check
Codecov requires an account and token to function. Replace it with
a self-contained `go tool cover` step that fails the build if total
coverage drops below 50% (currently ~58%). This catches test
regressions without external service dependencies.
2026-02-23 17:16:09 +01:00
Houmgaor
e8963ce0cf ci: add release workflow to publish binaries on tag push
Users without a Go toolchain can now download pre-built binaries
directly from GitHub Releases (closes #161). The workflow triggers
on v* tags, builds Linux and Windows amd64 archives, and attaches
them along with SCHEMA.sql to an auto-generated release.

Also fixes the README badge URL (go-improved.yml → go.yml).
2026-02-22 20:08:25 +01:00
Houmgaor
bcb5086dbb chore: remove stale TODO, update codecov-action to v5, refresh tech debt doc
The guild daily RP rollover TODO in handlers_guild_ops.go was stale —
the feature was already implemented via lazy rollover in
handlers_guild.go. Several other items in technical-debt.md were also
resolved in prior commits (typos, db guard investigation). Updated
the doc to reflect current state and bumped codecov-action to v5.
2026-02-22 18:38:10 +01:00
Houmgaor
de00e41830 chore: fix typos, remove stale comment, and update codecov-action to v4
- Remove misleading "For Debuging" comment in sys_session.go
- Fix "offical" → "official" typo in handlers_session.go
- Update codecov-action@v3 → @v4 in CI workflow
- Consolidate technical-debt.md with completed items and updated TOC
2026-02-22 18:20:09 +01:00
Houmgaor
28bf6e93fb ci: bump golangci-lint to v2.10.1 for Go 1.25 support
v2.1.6 was built with Go 1.24 and refuses to lint Go 1.25 code.
2026-02-20 21:13:54 +01:00
Houmgaor
e3970bfda5 ci: make lint block build and deduplicate test runs
- Add lint to build job's needs so lint failures prevent artifacts
- Combine race detector + coverage into a single test run
- Pin golangci-lint to v2.1.6 to avoid surprise breakage
- Rename workflow from go-improved.yml to go.yml
2026-02-20 21:10:20 +01:00
Houmgaor
abb40f163c ci: remove --out-format flag for golangci-lint v2 compatibility
golangci-lint v2 removed the --out-format CLI flag, causing the lint
job to fail. The golangci-lint-action v7 already uses problem matchers
to surface issues natively in GitHub Actions.
2026-02-17 23:43:45 +01:00
Houmgaor
2a0e3e2c84 fix: re-enable CI lint job and fix ~65 lint errors (partial)
Re-enable the golangci-lint job in CI (disabled Oct 2025), update to
Go 1.25 and golangci-lint-action v7. Fix errcheck, gosimple S1009,
staticcheck SA4031 and SA2001 errors across 54 files. Remaining ~39
lint errors will be addressed in follow-up commits.
2026-02-17 17:59:00 +01:00
Houmgaor
89d97a15b6 ci: remove redundant go.yml workflow
go-improved.yml is a superset (tests + build). Also fix its path
trigger to reference itself and include main.go.
2026-02-17 00:32:11 +01:00
Houmgaor
7d54dd0ee6 ci: add Docker CD workflow to push images to GHCR
Multi-stage Dockerfile for smaller runtime image, CD workflow triggers
on main branch pushes and version tags, docker-compose defaults to the
prebuilt GHCR image.
2026-02-17 00:28:37 +01:00
Houmgaor
b1c8b2848f security: fix CodeQL warnings for integer overflow and workflow permissions
- handlers_tower.go: add bounds checks before int-to-int16 and int-to-uint16
  conversions to prevent overflow/wraparound (CodeQL #7, #8)
- go-improved.yml, go.yml: add top-level `permissions: contents: read` to
  restrict workflow token scope (CodeQL #15, #16, #17)
2026-02-16 19:14:14 +01:00
Houmgaor
e31a37e0f9 chore: upgrading minimal Go from 1.23 to 1.25. 2025-11-09 16:51:02 +01:00
Houmgaor
4908731773 fix(ci): remove linting, fix not passing test. 2025-10-19 23:39:23 +02:00
Houmgaor
f79e05c0c9 feat(go): upgrade from go 1.21 to 1.23
BREAKING CHANGE: will not work properly with Go 1.21.
2025-10-19 22:24:48 +02:00
Houmgaor
cde7995132 feat(ci): trying a new CI pipeline. 2025-10-19 22:00:14 +02:00
wish
d17d97fefc update workflow 2025-02-18 03:20:43 +11:00
wish
51ae16541f update workflow 2025-02-18 03:18:54 +11:00
stratic-dev
463ceba555 Added github action 2024-01-22 22:45:31 +00:00
wish
105a118163 filter workflow triggers 2023-11-19 23:13:34 +11:00
wish
b7903f4e7a update to Golang 1.21 2023-08-20 18:44:33 +10:00
wish
fdb966b11c update Golang version in actions workflow 2023-08-20 16:19:05 +10:00
wish
6cffb84606 repository cleanup 2022-10-09 05:49:38 +11:00
wish
dd883a2216 Update go.yml 2022-08-04 21:20:27 +10:00
wish
2c0e7a5267 repository cleanup 2022-07-29 03:25:23 +10:00
wish
a0be6c627c repository cleanup 2022-07-29 03:12:08 +10:00
wish
6f3f88165f repository cleanup 2022-07-29 02:57:11 +10:00
wish
48422d3c47 build savedata folder into artifact 2022-07-29 01:34:54 +10:00
wish
60d9d5b305 actions v2 (#9) 2022-07-27 12:35:48 +10:00
wish
85c9743959 implement build actions (#8) 2022-07-26 21:17:28 +10:00