Enable integration tests (#760)
* Enable integration tests * Install chromium * Enable webServer * Run docker compose * Build docker images * Set working dir * Add Makefile * Fix healthcheck
This commit is contained in:
13
.github/workflows/go.yml
vendored
13
.github/workflows/go.yml
vendored
@@ -19,9 +19,8 @@ jobs:
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.25'
|
||||
- name: go fmt
|
||||
run: go fmt ./...
|
||||
working-directory: db
|
||||
|
||||
- run: make db-fmt
|
||||
- name: Ensure formatting
|
||||
run: |
|
||||
if [ -n "$(gofmt -l .)" ]; then
|
||||
@@ -30,9 +29,5 @@ jobs:
|
||||
fi
|
||||
git diff --exit-code
|
||||
working-directory: db
|
||||
- name: go vet
|
||||
run: go vet ./...
|
||||
working-directory: db
|
||||
- name: go test
|
||||
run: go test ./...
|
||||
working-directory: db
|
||||
- run: make db-vet
|
||||
- run: make db-test
|
||||
|
||||
20
.github/workflows/web.yaml
vendored
20
.github/workflows/web.yaml
vendored
@@ -14,9 +14,6 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
@@ -25,6 +22,17 @@ jobs:
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- run: npm install
|
||||
- run: npm run check
|
||||
- run: npm run test:unit
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- run: make db-build-docker
|
||||
|
||||
- run: make web-build-docker
|
||||
|
||||
- run: docker compose up -d
|
||||
|
||||
- run: make web-install
|
||||
- run: make web-playwright-install
|
||||
- run: make web-check
|
||||
- run: make web-test
|
||||
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
## db
|
||||
|
||||
.PHONY: db-fmt
|
||||
db-fmt:
|
||||
cd db && go fmt ./...
|
||||
|
||||
.PHONY: db-vet
|
||||
db-vet:
|
||||
cd db && go vet ./...
|
||||
|
||||
.PHONY: db-test
|
||||
db-test:
|
||||
cd db && go test ./...
|
||||
|
||||
.PHONY: db-build
|
||||
db-build:
|
||||
cd db && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pocketbase_amd64
|
||||
|
||||
.PHONY: db-build-docker
|
||||
db-build-docker: db-build
|
||||
docker buildx build db/ --no-cache -t flomp/wanderer-db:latest
|
||||
|
||||
## Web
|
||||
|
||||
.PHONY: web-install
|
||||
web-install:
|
||||
cd web && npm install
|
||||
|
||||
.PHONY: web-playwright-install
|
||||
web-playwright-install:
|
||||
cd web && npx playwright install --with-deps chromium
|
||||
|
||||
.PHONY: web-check
|
||||
web-check:
|
||||
cd web && npm run check
|
||||
|
||||
.PHONY: web-test
|
||||
web-test:
|
||||
cd web && npm run test
|
||||
|
||||
.PHONY: web-build-docker
|
||||
web-build-docker:
|
||||
docker buildx build web/ --no-cache -t flomp/wanderer-web:latest
|
||||
@@ -30,7 +30,7 @@ services:
|
||||
volumes:
|
||||
- pb_data:/pb_data
|
||||
healthcheck:
|
||||
test: wget --spider -q http://localhost:8090/health || exit 1
|
||||
test: ["CMD", "/curl", "--fail", "http://localhost:8090/health"]
|
||||
interval: 15s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
@@ -62,7 +62,7 @@ services:
|
||||
- "3000"
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:3000/ || exit 1
|
||||
test: ["CMD", "/curl", "--fail", "http://localhost:3000/"]
|
||||
interval: 15s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
|
||||
@@ -42,7 +42,7 @@ services:
|
||||
volumes:
|
||||
- ./data/pb_data:/pb_data
|
||||
healthcheck:
|
||||
test: wget --spider -q http://localhost:8090/health || exit 1
|
||||
test: ["CMD", "/curl", "--fail", "http://localhost:8090/health"]
|
||||
interval: 15s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
@@ -76,7 +76,7 @@ services:
|
||||
- wanderer
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:3000/ || exit 1
|
||||
test: ["CMD", "/curl", "--fail", "http://localhost:3000/"]
|
||||
interval: 15s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
|
||||
@@ -24,7 +24,7 @@ export default defineConfig({
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: "http://localhost:5173",
|
||||
baseURL: "http://localhost:3000",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
|
||||
Reference in New Issue
Block a user