Skip to content

Bump puppeteer from 21.9.0 to 22.12.1 #1899

Bump puppeteer from 21.9.0 to 22.12.1

Bump puppeteer from 21.9.0 to 22.12.1 #1899

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test CI
on:
pull_request:
push:
branches:
- master
release:
types:
- created
schedule:
- cron: '0 15 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
flake8:
name: Check python linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8' # lint with minimal version supported (3.8 in 20.04)
- name: Install dependencies
run: |
echo "${{ github.event_name }}! ${{ github.event.action }}"
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 src
eslint:
runs-on: ubuntu-latest
name: Check javascript linting
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
npm ci
- name: Lint with eslint
run: |
npm run lint
test:
name: Python Unittests
runs-on: ${{ matrix.os }}
needs: [flake8, eslint]
strategy:
matrix:
os: ['ubuntu-20.04', 'ubuntu-22.04']
include:
- os: 'ubuntu-20.04'
python-version: '3.8' # default python version in 20.04
- os: 'ubuntu-22.04'
python-version: '3.10' # default python version in 22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get -q -y install nodejs npm ca-certificates
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt -U
pip install -r requirements-dev.txt
npm ci
- name: Test with coverage
run: |
cd src
coverage run ./manage.py test
coverage run -a ./manage.py test --settings screamshotter.settings.test_timeout screenshotter.tests.CaptureTestCase.test_timeout_screenshot
- name: Coverage upload
run: |
pip install codecov
cd src
codecov
build_docker_image:
name: Build docker image
runs-on: ubuntu-20.04
needs: [test]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: |
docker build -t screamshotter_ci:latest .
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "screamshotter_ci:latest"
build_deb_20_04:
name: Build 20.04 package
runs-on: ubuntu-latest
container: ubuntu:focal
needs: [test]
env:
LANG: C.UTF-8
steps:
- uses: actions/checkout@v4
- name: Prepare debian 20.04 versioning
run: |
sed -i 's/+dev/.ubuntu20.04~dev'$GITHUB_RUN_ID'/' debian/changelog
sed -i 's/screamshotter (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/screamshotter (\1.ubuntu20.04\2) focal;/' debian/changelog
- name: Install build dependencies
run: |
apt-get update -q
apt-get install -q -y software-properties-common
add-apt-repository ppa:jyrki-pulliainen/dh-virtualenv
apt-get install -q -y dpkg-dev debhelper dh-virtualenv git python3 python3-venv python3-dev libgtk-3-0 libasound2 libgbm1 libxshmfence1
- name: Building package debian 20.04
run: |
dpkg-buildpackage -uc -us -b
- name: Archive package artifact
uses: actions/upload-artifact@v4
with:
name: debian-20-04
path: |
/home/runner/work/screamshotter/*.deb
build_deb_22_04:
name: Build 22.04 package
runs-on: ubuntu-latest
container: ubuntu:jammy
needs: [test]
env:
LANG: C.UTF-8
steps:
- uses: actions/checkout@v4
- name: Prepare debian 22.04 versioning
run: |
sed -i 's/+dev/.ubuntu22.04~dev'$GITHUB_RUN_ID'/' debian/changelog
sed -i 's/screamshotter (\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)) RELEASED;/screamshotter (\1.ubuntu22.04\2) jammy;/' debian/changelog
- name: Install build dependencies
run: |
apt-get update -q
apt-get install -q -y dpkg-dev debhelper dh-virtualenv git python3 python3-venv python3-dev libgtk-3-0 libasound2 libgbm1 libxshmfence1
- name: Building package debian 20.04
run: |
dpkg-buildpackage -uc -us -b
- name: Archive package artifact
uses: actions/upload-artifact@v4
with:
name: debian-22-04
path: |
/home/runner/work/screamshotter/*.deb
e2e_docker_image:
name: Tests E2E docker
runs-on: ubuntu-latest
needs: [build_docker_image]
steps:
- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "screamshotter_ci:latest"
- name: Launch service
run: |
docker run -d -p 8000:8000 screamshotter_ci:latest
echo "Waiting for container..."
while ! nc -z "127.0.0.1" "8000"; do
sleep 0.1
done
- name: E2E test
run: |
sleep 2
curl -d url=https://google.com http:https://localhost:8000 > google.png
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Check result
run: |
pip install filetype
if filetype -f google.png |grep -q 'image/png'; then
echo "File is PNG";
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
uses: actions/upload-artifact@v4
with:
name: result-docker
path: |
/home/runner/work/screamshotter/screamshotter/google.png
e2e_deb_20_04:
name: Tests E2E 20.04
runs-on: ubuntu-20.04
needs: [ build_deb_20_04 ]
steps:
- uses: actions/download-artifact@v4
with:
name: debian-20-04
- name: Install package
run: |
sudo apt-get install -y /home/runner/work/screamshotter/screamshotter/*.deb
- name: E2E test
run: |
curl -d url=https://google.com http:https://localhost:8000 > google.png
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Check result
run: |
pip install filetype
if filetype -f google.png |grep -q 'image/png'; then
echo "File is PNG";
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
uses: actions/upload-artifact@v4
with:
name: result-20-04
path: |
/home/runner/work/screamshotter/screamshotter/google.png
e2e_deb_22_04:
name: Tests E2E 22.04
runs-on: ubuntu-22.04
needs: [ build_deb_22_04 ]
steps:
- uses: actions/download-artifact@v4
with:
name: debian-22-04
- name: Install package
run: |
sudo apt-get install -y /home/runner/work/screamshotter/screamshotter/*.deb
- name: E2E test
run: |
curl -d url=https://google.com http:https://localhost:8000 > google.png
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Check result
run: |
pip install filetype
if filetype -f google.png |grep -q 'image/png'; then
echo "File is PNG";
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
uses: actions/upload-artifact@v4
with:
name: result-22-04
path: |
/home/runner/work/screamshotter/screamshotter/google.png
deploy:
name: Publish (on release only)
runs-on: ubuntu-latest
needs: [ e2e_docker_image, e2e_deb_20_04, e2e_deb_22_04 ]
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
steps:
- name: Download 20.04 debian artifact
uses: actions/download-artifact@v4
with:
name: debian-20-04
# - name: Download 22.04 debian artifact
# uses: actions/download-artifact@v4
# with:
# name: debian-22-04
- name: Download docker image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "screamshotter_ci:latest"
- name: Attach debian packages as release binaries
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: '*.deb'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish Docker image (tag, v2, latest or dev)
run: |
if [[ "${{ github.ref }}" == *"dev"* ]]; then
export DOCKER_TAG=dev
else
docker tag screamshotter_ci:latest makinacorpus/screamshotter:v${{github.ref_name}}
docker push makinacorpus/screamshotter:v${{github.ref_name}}
docker tag screamshotter_ci:latest makinacorpus/screamshotter:v2
docker push makinacorpus/screamshotter:v2
export DOCKER_TAG=latest
fi
docker tag screamshotter_ci:latest makinacorpus/screamshotter:$DOCKER_TAG
docker push makinacorpus/screamshotter:$DOCKER_TAG
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Publish debian packages
run: |
if [[ "${{ github.ref }}" == *"dev"* ]]; then
export DEB_COMPONENT=dev
else
export DEB_COMPONENT=main
fi
echo "${{ github.ref }} : Publishing as $DEB_COMPONENT package"
scp -P ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no /home/runner/work/screamshotter/screamshotter/screamshotter_*_amd64.deb ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/srv/packages/incoming/$DEB_COMPONENT/
if [[ "${{ github.ref }}" == *"dev"* ]]; then
ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make focal_dev -C /srv/packages
# ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make jammy_dev -C /srv/packages
else
ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make focal_main -C /srv/packages
# ssh -p ${{ secrets.SSH_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} make jammy_main -C /srv/packages
fi