forked from mirrors/homebox
ci: end-to-end CI testing (#1)
* do end-to-end testing * set node version * build then start * remove test restrictions * panic if mime type fails * use timeout
This commit is contained in:
parent
ad4c8c9ab4
commit
7ccd48ad79
4 changed files with 26 additions and 16 deletions
23
.github/workflows/frontend.yaml
vendored
23
.github/workflows/frontend.yaml
vendored
|
@ -1,19 +1,25 @@
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
|
||||||
- "**.ts"
|
|
||||||
- "**.vue"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
|
||||||
- "**.ts"
|
|
||||||
- "**.vue"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Frontend:
|
Frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Task
|
||||||
|
uses: arduino/setup-task@v1
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2.2.2
|
- uses: pnpm/action-setup@v2.2.2
|
||||||
with:
|
with:
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
|
@ -27,6 +33,5 @@ jobs:
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
|
|
||||||
- name: Vitest
|
- name: Run Integration Tests
|
||||||
run: pnpm test:ci
|
run: task test:integration
|
||||||
working-directory: frontend
|
|
||||||
|
|
5
.github/workflows/go.yaml
vendored
5
.github/workflows/go.yaml
vendored
|
@ -3,12 +3,8 @@ name: Go Build/Test
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
|
||||||
- "**.go"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
|
||||||
- "**.go"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Go:
|
Go:
|
||||||
|
@ -31,6 +27,7 @@ jobs:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
# Optional: working directory, useful for monorepos
|
# Optional: working directory, useful for monorepos
|
||||||
|
timeout: 5m
|
||||||
working-directory: backend
|
working-directory: backend
|
||||||
|
|
||||||
- name: Build API
|
- name: Build API
|
||||||
|
|
|
@ -33,7 +33,8 @@ tasks:
|
||||||
|
|
||||||
test:integration:
|
test:integration:
|
||||||
cmds:
|
cmds:
|
||||||
- cd backend && go run ./app/api/ &
|
- cd backend && go build ./app/api
|
||||||
|
- backend/api &
|
||||||
- sleep 5
|
- sleep 5
|
||||||
- cd frontend && pnpm run test:ci
|
- cd frontend && pnpm run test:ci
|
||||||
silent: true
|
silent: true
|
||||||
|
|
|
@ -107,8 +107,15 @@ func (a *app) LogRoutes(r *chi.Mux) {
|
||||||
var ErrDir = errors.New("path is dir")
|
var ErrDir = errors.New("path is dir")
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
mime.AddExtensionType(".js", "application/javascript")
|
err := mime.AddExtensionType(".js", "application/javascript")
|
||||||
mime.AddExtensionType(".mjs", "application/javascript")
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = mime.AddExtensionType(".mjs", "application/javascript")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func tryRead(fs embed.FS, prefix, requestedPath string, w http.ResponseWriter) error {
|
func tryRead(fs embed.FS, prefix, requestedPath string, w http.ResponseWriter) error {
|
||||||
|
|
Loading…
Reference in a new issue