Open7

Github ActionsでPlaywright installで失敗する問題

taizo-taizo-

GithubActionsで発生していたエラー

Run npx playwright install chromium --with-deps
Installing dependencies...
Switching to root user to install dependencies...
Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B]
Get:6 https://packages.microsoft.com/ubuntu/24.04/prod noble InRelease [3600 B]
Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease
Get:3 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [774 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu noble-updates/main Translation-en [176 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [151 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [974 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe Translation-en [242 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [310 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Components [212 B]
Get:14 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
Get:15 http://azure.archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [208 B]
Get:16 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [11.7 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [216 B]
Get:18 http://azure.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B]
Get:19 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Packages [586 kB]
Get:20 http://azure.archive.ubuntu.com/ubuntu noble-security/main Translation-en [114 kB]
Get:21 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Components [7188 B]
Get:22 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Packages [800 kB]
Get:23 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Components [52.0 kB]
Get:24 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted amd64 Components [212 B]
Get:25 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [212 B]
Fetched 4582 kB in 1s (4737 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package libasound2 is a virtual package provided by:
  liboss4-salsa-asound2 4.2-build2020-1ubuntu3
  libasound2t64 1.2.11-1build2 (= 1.2.11-1build2)

E: Package 'libasound2' has no installation candidate
Failed to install browsers
Error: Installation process exited with code: 100
Error: Process completed with exit code 1.
taizo-taizo-

実際のワークフローがこれ

name: Browser Synthetic Monitoring Setup

on:
  workflow_dispatch:

jobs:
  vrt-init:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: ".tool-versions"
          cache: "npm"

      - name: Install dependencies
        id: npm-install
        run: |
          npm ci
          PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version')
          echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT

      - name: Cache playwright binaries
        uses: actions/cache@v4
        id: playwright-cache
        with:
          path: ~/.cache/ms-playwright
          key: playwright-${{ steps.npm-install.outputs.PLAYWRIGHT_VERSION }}
          restore-keys: playwright-

      - name: Install playwright
        run: npx playwright install chromium --with-deps

      - name: Run VRT init
        run: npm run vrt:init:***
        env:
            ***

      - name: Cache VRT snapshots
        uses: actions/cache/save@v4
        id: vrt-cache
        with:
          path: tests/snapshots
          key: vrt

taizo-taizo-

Playwrightのバージョンを最新にしたら通った!