Skip to content

Commit

Permalink
Merge branch 'vnext' into mk/add-analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
tankerkiller125 authored Oct 30, 2024
2 parents a8b4a0b + d1febd5 commit 0c2141c
Show file tree
Hide file tree
Showing 92 changed files with 2,970 additions and 524 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [tankerkiller125,katosdev]
github: [tankerkiller125,katosdev,tonyaellie]
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
schedule:
- cron: '00 0 * * *'
push:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'

env:
# Use docker.io for Docker Hub if empty
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish-rootless-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
schedule:
- cron: '00 0 * * *'
push:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'

env:
# Use docker.io for Docker Hub if empty
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish-rootless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
schedule:
- cron: '00 0 * * *'
push:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'


env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
schedule:
- cron: '00 0 * * *'
push:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
branches: [ "main", "vnext" ]
paths:
- 'backend/**'
- 'frontend/**'
- 'Dockerfile'
- 'Dockerfile.rootless'
- '.dockerignore'
- '.github/workflows'
- '.github/workflows/**'

env:
# Use docker.io for Docker Hub if empty
Expand Down
68 changes: 66 additions & 2 deletions .github/workflows/partial-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 6.0.2
version: 9.12.2

- name: Install dependencies
run: pnpm install --shamefully-hoist
Expand All @@ -32,6 +32,20 @@ jobs:
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: homebox
POSTGRES_PASSWORD: homebox
POSTGRES_DB: homebox
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -54,11 +68,61 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 6.0.2
version: 9.12.2

- name: Install dependencies
run: pnpm install
working-directory: frontend

- name: Run Integration Tests
run: task test:ci
integration-tests-pgsql:
strategy:
matrix:
database_version: [17,16,15]
name: Integration Tests PGSQL ${{ matrix.database_version }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.database_version }}
env:
POSTGRES_USER: homebox
POSTGRES_PASSWORD: homebox
POSTGRES_DB: homebox
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

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

- uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/[email protected]
with:
version: 9.12.2

- name: Install dependencies
run: pnpm install
working-directory: frontend

- name: Run Integration Tests
run: task test:ci:postgresql
2 changes: 2 additions & 0 deletions .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
pull_request:
branches:
- main
- vnext

paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/**'

jobs:
backend-tests:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
backend/.data/*
config.yml
homebox.db
homebox.db-journal
homebox.db-shm
homebox.db-wal
.idea
.DS_Store
test-mailer.json
Expand Down
54 changes: 52 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version: "3"

env:
HBOX_LOG_LEVEL: debug
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1
HBOX_DATABASE_DRIVER: sqlite3
HBOX_DATABASE_SQLITE_PATH: .data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1
HBOX_OPTIONS_ALLOW_REGISTRATION: true
UNSAFE_DISABLE_PASSWORD_PROJECTION: "yes_i_am_sure"
tasks:
Expand Down Expand Up @@ -62,6 +63,23 @@ tasks:
- go run ./app/api/ {{ .CLI_ARGS }}
silent: false

go:run:postgresql:
env:
HBOX_DATABASE_DRIVER: postgres
HBOX_DATABASE_USERNAME: homebox
HBOX_DATABASE_PASSWORD: homebox
HBOX_DATABASE_DATABASE: homebox
HBOX_DATABASE_HOST: localhost
HBOX_DATABASE_PORT: 5432
HBOX_DATABASE_SSL_MODE: disable
desc: Starts the backend api server with postgresql (depends on generate task)
dir: backend
deps:
- generate
cmds:
- go run ./app/api/ {{ .CLI_ARGS }}
silent: false

go:test:
desc: Runs all go tests using gotestsum - supports passing gotestsum args
dir: backend
Expand Down Expand Up @@ -116,6 +134,21 @@ tasks:
cmds:
- cd backend && go run app/tools/migrations/main.go {{ .CLI_ARGS }}

db:migration:postgresql:
env:
HBOX_DATABASE_DRIVER: postgres
HBOX_DATABASE_USERNAME: homebox
HBOX_DATABASE_PASSWORD: homebox
HBOX_DATABASE_DATABASE: homebox
HBOX_DATABASE_HOST: localhost
HBOX_DATABASE_PORT: 5432
HBOX_DATABASE_SSL_MODE: disable
desc: Runs the database diff engine to generate a SQL migration files for postgresql
deps:
- db:generate
cmds:
- cd backend && go run app/tools/migrations/main.go {{ .CLI_ARGS }}

ui:watch:
desc: Starts the vitest test runner in watch mode
dir: frontend
Expand Down Expand Up @@ -145,7 +178,24 @@ tasks:
cmds:
- cd backend && go build ./app/api
- backend/api &
- sleep 5
- sleep 10
- cd frontend && pnpm run test:ci
silent: true

test:ci:postgresql:
env:
HBOX_DATABASE_DRIVER: postgres
HBOX_DATABASE_USERNAME: homebox
HBOX_DATABASE_PASSWORD: homebox
HBOX_DATABASE_DATABASE: homebox
HBOX_DATABASE_HOST: 127.0.0.1
HBOX_DATABASE_PORT: 5432
HBOX_DATABASE_SSL_MODE: disable
desc: Runs end-to-end test on a live server with postgresql (only for use in CI)
cmds:
- cd backend && go build ./app/api
- backend/api &
- sleep 10
- cd frontend && pnpm run test:ci
silent: true

Expand Down
Loading

0 comments on commit 0c2141c

Please sign in to comment.