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
|
- uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: '1.25'
|
go-version: '1.25'
|
||||||
- name: go fmt
|
|
||||||
run: go fmt ./...
|
- run: make db-fmt
|
||||||
working-directory: db
|
|
||||||
- name: Ensure formatting
|
- name: Ensure formatting
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(gofmt -l .)" ]; then
|
if [ -n "$(gofmt -l .)" ]; then
|
||||||
@@ -30,9 +29,5 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
working-directory: db
|
working-directory: db
|
||||||
- name: go vet
|
- run: make db-vet
|
||||||
run: go vet ./...
|
- run: make db-test
|
||||||
working-directory: db
|
|
||||||
- name: go test
|
|
||||||
run: go test ./...
|
|
||||||
working-directory: db
|
|
||||||
|
|||||||
20
.github/workflows/web.yaml
vendored
20
.github/workflows/web.yaml
vendored
@@ -14,9 +14,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: web
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
@@ -25,6 +22,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
|
||||||
- run: npm install
|
- uses: actions/setup-go@v6
|
||||||
- run: npm run check
|
with:
|
||||||
- run: npm run test:unit
|
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:
|
volumes:
|
||||||
- pb_data:/pb_data
|
- pb_data:/pb_data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget --spider -q http://localhost:8090/health || exit 1
|
test: ["CMD", "/curl", "--fail", "http://localhost:8090/health"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
@@ -62,7 +62,7 @@ services:
|
|||||||
- "3000"
|
- "3000"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl --fail http://localhost:3000/ || exit 1
|
test: ["CMD", "/curl", "--fail", "http://localhost:3000/"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./data/pb_data:/pb_data
|
- ./data/pb_data:/pb_data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget --spider -q http://localhost:8090/health || exit 1
|
test: ["CMD", "/curl", "--fail", "http://localhost:8090/health"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
@@ -76,7 +76,7 @@ services:
|
|||||||
- wanderer
|
- wanderer
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl --fail http://localhost:3000/ || exit 1
|
test: ["CMD", "/curl", "--fail", "http://localhost:3000/"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 20s
|
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. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* 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 */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
|
|||||||
Reference in New Issue
Block a user