From 6525712af90a44b0a24732324ec7aff07f4dfd10 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 02:50:39 +0900 Subject: [PATCH 1/4] fix: Use Playwright Docker image for CI to resolve dependency issues - Switch to official Playwright Docker image (mcr.microsoft.com/playwright:v1.48.0-noble) - Remove manual browser installation steps as they're pre-installed in the image - Set PLAYWRIGHT_BROWSERS_PATH environment variable to use pre-installed browsers - Keep Playwright CLI installation for Go integration This resolves all missing system dependencies that were preventing Playwright tests from running in CI. Fixes #68 --- .github/workflows/ci.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fe9d50..45699e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,9 @@ jobs: test: name: Test runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.48.0-noble + options: --user 1001 strategy: matrix: @@ -45,22 +48,17 @@ jobs: - name: Build run: go build -v ./... - - name: Install Playwright CLI + - name: Install Playwright CLI for Go run: go install github.com/playwright-community/playwright-go/cmd/playwright@latest - - name: Cache Playwright browsers - uses: actions/cache@v4 - with: - path: ~/.cache/ms-playwright - key: ${{ runner.os }}-playwright-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-playwright- - - - name: Install Playwright browsers - run: playwright install --with-deps chromium + # Playwright browsers are already installed in the Docker image + # No need to install or cache them separately - name: Run tests run: go test -v -race -coverprofile=coverage.out ./... + env: + # Ensure Playwright uses the pre-installed browsers + PLAYWRIGHT_BROWSERS_PATH: /ms-playwright - name: Upload coverage to Codecov if: matrix.go-version == '1.24' From 02b63a0e58008ec8a82d21fb56c2cfa242863240 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 02:53:29 +0900 Subject: [PATCH 2/4] fix: Install GCC and enable CGO in Docker container - Install gcc, g++, and libc6-dev for CGO support - Set CGO_ENABLED=1 for race detection - Required for running tests with -race flag in Docker container --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45699e1..3e178d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,11 @@ jobs: go-version: ${{ matrix.go-version }} cache: true + - name: Install build dependencies + run: | + apt-get update + apt-get install -y gcc g++ libc6-dev + - name: Download dependencies run: go mod download @@ -57,6 +62,8 @@ jobs: - name: Run tests run: go test -v -race -coverprofile=coverage.out ./... env: + # Enable CGO for race detection + CGO_ENABLED: 1 # Ensure Playwright uses the pre-installed browsers PLAYWRIGHT_BROWSERS_PATH: /ms-playwright From 7614fc09c1d3181bf8584390d20344e414f7c496 Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 02:56:10 +0900 Subject: [PATCH 3/4] fix: Remove user restriction in Docker container Allow running as root user to install system packages with apt-get --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e178d9..4949a92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ jobs: runs-on: ubuntu-latest container: image: mcr.microsoft.com/playwright:v1.48.0-noble - options: --user 1001 strategy: matrix: From 44f5da59b09247a4a4d00f3b1f7ece74222b3b4a Mon Sep 17 00:00:00 2001 From: Shuji Aoshima <47586723+aoshimash@users.noreply.github.com> Date: Sun, 27 Jul 2025 02:59:46 +0900 Subject: [PATCH 4/4] fix: Add git safe.directory configuration for Docker Fix 'dubious ownership' error by adding the workspace directory to git's safe.directory list --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4949a92..5a1247b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,11 @@ jobs: go-version: ${{ matrix.go-version }} cache: true - - name: Install build dependencies + - name: Setup environment run: | + # Fix git ownership issue in Docker + git config --global --add safe.directory /__w/urlmap/urlmap + # Install build dependencies apt-get update apt-get install -y gcc g++ libc6-dev