ci: automatic pinning of Firefox Nightly for testing (#11619)

This commit is contained in:
Nikolay Vitkov 2024-01-03 13:09:24 +01:00 committed by GitHub
parent 6f7f682e05
commit 5d69ccb17a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 6 deletions

View File

@ -11,7 +11,7 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
update: update-chrome:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository - name: Check out repository
@ -29,13 +29,45 @@ jobs:
- name: Update Chrome to latest stable version - name: Update Chrome to latest stable version
id: update id: update
run: | run: |
node --experimental-fetch tools/update_chrome_revision.mjs node tools/update_chrome_revision.mjs
- name: Create Pull Request - name: Create Pull Request
if: ${{ steps.update.outputs.commit }} if: ${{ steps.update.outputs.commit }}
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with: with:
token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }} token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }}
branch: browser-automation-bot/update-browser-version branch: browser-automation-bot/update-browser-version-chrome
delete-branch: true
committer: Browser Automation Bot <browser-automation-bot@google.com>
author: Browser Automation Bot <browser-automation-bot@google.com>
commit-message: ${{ steps.update.outputs.commit }}
title: ${{ steps.update.outputs.commit }}
body: 'Automatically generated by https://github.com/puppeteer/puppeteer/blob/main/.github/workflows/update-browser-pins.yml'
labels: dependencies
update-firefox:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
cache: npm
node-version: lts/*
- uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1
- name: Install npm dependencies
run: npm ci
- name: Build Puppeteer
run: npm run build:test -w @puppeteer/browsers
- name: Update Firefox to latest nightly version
id: update
run: |
node packages/browsers/tools/updateVersions.mjs
- name: Create Pull Request
if: ${{ steps.update.outputs.commit }}
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }}
branch: browser-automation-bot/update-browser-version-firefox
delete-branch: true delete-branch: true
committer: Browser Automation Bot <browser-automation-bot@google.com> committer: Browser Automation Bot <browser-automation-bot@google.com>
author: Browser Automation Bot <browser-automation-bot@google.com> author: Browser Automation Bot <browser-automation-bot@google.com>

View File

@ -5,6 +5,7 @@
"scripts": { "scripts": {
"build:docs": "wireit", "build:docs": "wireit",
"build": "wireit", "build": "wireit",
"build:test": "wireit",
"clean": "../../tools/clean.js", "clean": "../../tools/clean.js",
"test": "wireit" "test": "wireit"
}, },

View File

@ -6,6 +6,10 @@
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import actions from '@actions/core';
import {testFirefoxBuildId} from '../test/build/versions.js';
const filePath = './test/src/versions.ts'; const filePath = './test/src/versions.ts';
const getVersion = async () => { const getVersion = async () => {
@ -28,6 +32,12 @@ const patch = (input, version) => {
const version = await getVersion(); const version = await getVersion();
if (testFirefoxBuildId !== version) {
actions.setOutput(
'commit',
`chore: update Firefox testing pin to ${version}`
);
const contents = await fs.readFile(filePath, 'utf8'); const contents = await fs.readFile(filePath, 'utf8');
const patched = patch(contents, version); const patched = patch(contents, version);
fs.writeFile(filePath, patched); fs.writeFile(filePath, patched);
}