feat(core): customizable Chromium executable path (#9670)

* feat(core): customizable Chromium executable path

also build Chromium-bundled Docker image for arm/arm64

Signed-off-by: Rongrong <i@rong.moe>

* chore: fix typo

Signed-off-by: Rongrong <i@rong.moe>

* chore(CI/test): using build matrix

Signed-off-by: Rongrong <i@rong.moe>

* docs(install): fix punctuation

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong
2022-05-01 21:00:29 +08:00
committed by GitHub
parent 05fd12eb35
commit 7a6be9a229
8 changed files with 151 additions and 31 deletions
+2 -2
View File
@@ -89,10 +89,10 @@ jobs:
push: true
tags: ${{ steps.meta-chromium-bundled.outputs.tags }}
labels: ${{ steps.meta-chromium-bundled.outputs.labels }}
platforms: linux/amd64 # bundled Chromium is only available on amd64
platforms: linux/amd64,linux/arm/v7,linux/arm64
cache-from: |
type=gha,scope=docker-release
type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:chromium-bundled
# type=gha,scope=docker-release # not needed, Docker automatically uses local cache from the builder
# type=registry,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:buildcache
cache-to: type=inline,ref=${{ secrets.DOCKER_USERNAME }}/rsshub:chromium-bundled # inline cache is enough
+49 -6
View File
@@ -1,6 +1,6 @@
name: test
on: [push, pull_request]
on: [ push, pull_request ]
permissions:
contents: read
@@ -16,7 +16,7 @@ jobs:
options: --entrypoint redis-server
strategy:
matrix:
node-version: ['14', '16']
node-version: [ '14', '16' ]
name: Jest on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
@@ -24,8 +24,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
- run: npm run jest:coverage
- name: Install dependencies (yarn)
run: yarn
- name: Test all and generate coverage
run: npm run jest:coverage
env:
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/
- name: Upload coverage to Codecov
@@ -34,11 +36,52 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos as documented, but seems broken
puppeteer:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ '14', '16' ]
chromium:
- name: bundled Chromium
dependency: ''
environment: '{}'
- name: Chromium from Ubuntu
dependency: chromium-browser
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "chromium-browser" }'
- name: Chrome from Google
dependency: google-chrome-stable
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "google-chrome-stable" }'
name: Jest puppeteer on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies (yarn)
run: yarn
- name: Install Chromium
if: ${{ matrix.chromium.dependency != '' }}
# Chromium from Ubuntu is too old (85), but can still pass the tests
# That's not really a problem since Chromium-bundled Docker image is based on Debian bullseye,
# which updates Chromium frequently, and only on arm/arm64 the image needs Chromium from Debian.
run: |
set -ex
curl -s "https://dl.google.com/linux/linux_signing_key.pub" | gpg --dearmor |
sudo tee /etc/apt/trusted.gpg.d/google-chrome.gpg > /dev/null
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" |
sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
sudo apt-get update
sudo apt-get install -yq --no-install-recommends ${{ matrix.chromium.dependency }}
- name: Test puppeteer
run: npm run jest puppeteer
env: ${{ fromJSON(matrix.chromium.environment) }}
docs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['14', '16']
node-version: [ '14', '16' ]
name: Build docs on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
@@ -54,7 +97,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['14', '16']
node-version: [ '14', '16' ]
name: Build radar and maintainer on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3