diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fe9d50..5a1247b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,8 @@ jobs: test: name: Test runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.48.0-noble strategy: matrix: @@ -25,6 +27,14 @@ jobs: go-version: ${{ matrix.go-version }} cache: true + - 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 + - name: Download dependencies run: go mod download @@ -45,22 +55,19 @@ 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: + # Enable CGO for race detection + CGO_ENABLED: 1 + # Ensure Playwright uses the pre-installed browsers + PLAYWRIGHT_BROWSERS_PATH: /ms-playwright - name: Upload coverage to Codecov if: matrix.go-version == '1.24'