update frontend #1188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pytest | |
# coverage is made up by multiple runs on different hosts | |
# self-hosted is a RPI and has hardware attached to test and gain high coverage | |
# after all jobs finished, coverage is uploaded as described here | |
# https://about.codecov.io/blog/uploading-code-coverage-in-a-separate-job-on-github-actions/ | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
env: | |
sharing__shareservice_apikey: "runnertestingpassword" | |
sharing__shareservice_url: "http://localhost:8082/dl.php" | |
PHP_CLI_SERVER_WORKERS: 6 | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.2" | |
ini-values: upload_max_filesize=50M, post_max_size=51M, memory_limit=200M, max_execution_time=180 | |
- name: start php built-in server to allow testing shareservice | |
run: | | |
sed -i '0,/changedefault!/s//runnertestingpassword/' extras/shareservice/dl.php | |
nohup php -S localhost:8082 -t extras/shareservice/ > phpd.log 2>&1 & | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install system apt dependencies | |
run: | | |
sudo apt update | |
sudo apt -y install libturbojpeg python3-pip libgl1 git libcap-dev | |
sudo apt -y install ffmpeg | |
- name: install pdm | |
run: | | |
pipx install pdm # on hosted pipx is installed | |
PDM_PREFER_BINARY=gphoto2 pdm install | |
- name: Run pytest | |
run: | | |
pdm run test | |
- name: output php logs | |
if: always() | |
run: | | |
cat phpd.log | |
cat extras/shareservice/php-error.log | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: coverage.xml | |
# tests-win: | |
# env: | |
# sharing__shareservice_apikey: "runnertestingpassword" | |
# sharing__shareservice_url: "http://localhost:8082/dl.php" | |
# PHP_CLI_SERVER_WORKERS: 6 | |
# runs-on: windows-latest | |
# continue-on-error: false | |
# strategy: | |
# fail-fast: true | |
# matrix: | |
# python-version: ["3.12"] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: shivammathur/setup-php@v2 | |
# with: | |
# php-version: "8.2" | |
# ini-values: upload_max_filesize=50M, post_max_size=51M, memory_limit=200M, max_execution_time=180 | |
# # - name: start php built-in server to allow testing shareservice | |
# # run: | | |
# # sed -i '0,/changedefault!/s//runnertestingpassword/' extras/shareservice/dl.php | |
# # nohup php -S localhost:8082 -t extras/shareservice/ > phpd.log 2>&1 & | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# # - name: Install system apt dependencies | |
# # run: | | |
# # sudo apt update | |
# # sudo apt -y install libturbojpeg python3-pip libgl1 git libcap-dev | |
# # sudo apt -y install ffmpeg | |
# - name: install pdm | |
# run: | | |
# pip install pdm | |
# - name: install app | |
# run: | | |
# pdm install | |
# - name: Run pytest | |
# run: | | |
# pdm run test | |
# # - name: output php logs | |
# # if: always() | |
# # run: | | |
# # cat phpd.log | |
# # cat extras/shareservice/php-error.log | |
# - uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-${{ matrix.python-version }} | |
# path: coverage.xml | |
tests-hardware-rpi: | |
env: | |
## Sets environment variable | |
backends__MAIN_BACKEND: VirtualCamera | |
hardwareinputoutput__wled_enabled: True | |
hardwareinputoutput__wled_serial_port: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 | |
runs-on: [self-hosted, rpi] | |
if: ${{ github.repository_owner == 'photobooth-app' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install apt dependencies | |
run: | | |
sudo apt update | |
sudo apt -y install libturbojpeg0 python3-pip libgl1 libgphoto2-dev pipx | |
sudo apt -y install ffmpeg | |
- run: pipx install pdm | |
- run: pipx ensurepath | |
- run: pdm venv create --force 3.11 --system-site-packages # incl system site to allow for picamera2 to import | |
- run: pdm install # install in-project env | |
- name: Test with pytest | |
run: | | |
pdm run test | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-hardware-rpi | |
path: ./coverage.xml | |
upload-to-codecov: | |
needs: [tests, tests-hardware-rpi] | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'photobooth-app' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |