diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e6b9ef47..b27543f2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml index b5dd480c..1ce1fd46 100644 --- a/.github/workflows/web.yaml +++ b/.github/workflows/web.yaml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..4763583b --- /dev/null +++ b/Makefile @@ -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 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index cd84ee87..f89161e6 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 9cbbfcb3..7a454972 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/web/playwright.config.ts b/web/playwright.config.ts index 68a4d5ed..28b97e36 100644 --- a/web/playwright.config.ts +++ b/web/playwright.config.ts @@ -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',