Skip to content

Commit

Permalink
(imp) use puppeteer-core (18.2 - 21.11)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Dec 16, 2024
1 parent 0586929 commit 36b8e23
Show file tree
Hide file tree
Showing 11 changed files with 5,155 additions and 5,656 deletions.
100 changes: 72 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,93 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
node-version:
- lts/fermium
- lts/gallium
- lts/iron
- lts/jod
puppeteer-version:
- '14.0'
- '14.1'
- '14.2'
- '14.3'
- '14.4'
- '15.0'
- '15.1'
- '15.2'
- '15.3'
- '15.4'
- '15.5'
- '16.0'
- '16.1'
- '16.2'
- '17.0'
- '17.1'
- '18.0'
- '18.1'
- '18.2'
- '19.0'
- '19.1'
- '19.2'
- '19.3'
- '19.4'
env:
PUPPETEER_CAPTURE__PUPPETEER_VERSION: -${{ matrix.puppeteer-version }}
- '19.5'
- '19.6'
- '19.7'
- '19.8'
- '19.9'
- '19.10'
- '19.11'
- '20.0'
- '20.1'
- '20.2'
- '20.3'
- '20.4'
- '20.5'
- '20.6'
- '20.7'
- '20.8'
- '20.9'
- '21.0'
- '21.1'
- '21.2'
- '21.3'
- '21.4'
- '21.5'
- '21.6'
- '21.7'
- '21.8'
- '21.9'
- '21.10'
- '21.11'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run lint
- run: npm run test

- name: Cache npm packages
uses: actions/cache@v4
with:
path: ${{ runner.os == 'Windows' && '~/AppData/Roaming/npm-cache' || '~/.npm' }}
key: npm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-${{ runner.arch }}

- name: Cache Puppeteer
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer/
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ matrix.puppeteer-version }}-${{ hashFiles('**/package-lock.json') }}

# NOTE: Chrome r112.0.5615.121 is not available on https://edgedl.me.gvt1.com, use 113.0.5672.63 from 20.1.0
- name: Override Chrome revision (for puppeteer@~20.0.0)
if: ${{ matrix.puppeteer-version == '20.0' }}
run: |
echo "PUPPETEER_BROWSER_REVISION=113.0.5672.63" >> ${{ runner.os == 'Windows' && '$env:GITHUB_ENV' || '$GITHUB_ENV' }}
- name: Install Puppeteer ${{ matrix.puppeteer-version }}
run: npm install --no-save 'puppeteer@~${{ matrix.puppeteer-version }}.0'

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm run test
env:
DEBUG: 'puppeteer:*'
DEBUG_MAX_STRING_LENGTH: 'null'

- name: Codecov
uses: codecov/codecov-action@v3.1.0
uses: codecov/codecov-action@v5
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
37 changes: 31 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,39 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
PUPPETEER_VERSION: 21.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm version "${GITHUB_REF##*/}" --allow-same-version --no-git-tag-version
- run: npm publish

- name: Cache npm packages
uses: actions/cache@v4
with:
path: ${{ runner.os == 'Windows' && '~/AppData/Roaming/npm-cache' || '~/.npm' }}
key: npm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-${{ runner.arch }}

- name: Cache Puppeteer
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer/
key: puppeteer-${{ runner.os }}-${{ runner.arch }}-${{ env.PUPPETEER_VERSION }}-${{ hashFiles('**/package-lock.json') }}

- name: Install latest supported Puppeteer
run: npm install --no-save 'puppeteer@~${{ env.PUPPETEER_VERSION }}.0'

- name: Install dependencies
run: npm ci

- name: Publish
run: |
npm version "${GITHUB_REF##*/}" --allow-same-version --no-git-tag-version
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = {
},
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
collectCoverage: true,
coverageReporters: ['lcov', 'html']
coverageReporters: ['lcov', 'html'],
slowTestThreshold: 30
}
Loading

0 comments on commit 36b8e23

Please sign in to comment.