Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.0-noble

strategy:
matrix:
Expand All @@ -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

Expand All @@ -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'
Expand Down