diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28e6013..f1868a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,8 @@ name: Build and Deploy Dockerfile on: - workflow_run: - workflows: ["Playwright Tests"] + push: branches: [main] - types: - - completed env: DOCKER_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/htmx-blog:latest @@ -13,7 +10,6 @@ env: jobs: website: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v4 with: @@ -24,7 +20,21 @@ jobs: uses: DeterminateSystems/magic-nix-cache-action@main - name: Build Docker image using Nix run: nix build ".#docker" - + + # Test playwright + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 + - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml deleted file mode 100644 index e9cd30c..0000000 --- a/.github/workflows/playwright.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Playwright Tests -on: - - push - - pull_request - -jobs: - test: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - uses: actions/setup-go@v4 - with: - go-version: "^1.21.3" - - # Build go app - - name: Install and generate templates - run: | - go install github.com/a-h/templ/cmd/templ@v0.2.501 - templ generate components - - name: Install pacakges - run: go get - - name: Build - run: go build - - # Set up playwright - - name: Install dependencies - run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - name: Run Playwright tests - run: npx playwright test - - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 diff --git a/playwright.config.ts b/playwright.config.ts index 6d37bae..d45f656 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -66,7 +66,7 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: process.env.CI ? { - command: "./htmx-blog", + command: "docker run -p 3000:3000 $IMAGE_TAG", url: "http://127.0.0.1:3000", reuseExistingServer: !process.env.CI, }