127 lines
3.3 KiB
YAML
127 lines
3.3 KiB
YAML
name: Python tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test-serverlibrary:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create virtual environment and install dependencies
|
|
working-directory: serverlibrary
|
|
run: |
|
|
python -m venv .venv
|
|
. .venv/bin/activate
|
|
python -m pip install --upgrade pip
|
|
python -m pip install .
|
|
- name: Run tests
|
|
working-directory: serverlibrary
|
|
run: |
|
|
. .venv/bin/activate
|
|
python run_tests.py
|
|
|
|
test-wallpaper-changer:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create virtual environment and install dependencies
|
|
working-directory: wallpaper_changer
|
|
run: |
|
|
python -m venv .venv
|
|
. .venv/bin/activate
|
|
python -m pip install --upgrade pip
|
|
python -m pip install ../serverlibrary
|
|
python -m pip install .
|
|
pip install --group test .
|
|
- name: Run tests
|
|
working-directory: wallpaper_changer
|
|
run: |
|
|
. .venv/bin/activate
|
|
python tests/run_tests.py
|
|
lint-wallpaper-changer:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Ruff
|
|
run: pip install ruff
|
|
|
|
- name: Lint wallpaper_changer
|
|
run: ruff check wallpaper_changer
|
|
|
|
lint-serverlibrary:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Ruff
|
|
run: pip install ruff
|
|
|
|
- name: Lint serverlibrary
|
|
run: ruff check serverlibrary
|
|
build:
|
|
needs: [test-serverlibrary, test-wallpaper-changer, lint-serverlibrary, lint-wallpaper-changer]
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install build dependencies
|
|
working-directory: wallpaper_changer
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install pyinstaller build
|
|
python -m pip install ../serverlibrary
|
|
python -m pip install .
|
|
|
|
- name: Build executable
|
|
working-directory: wallpaper_changer
|
|
run: |
|
|
python -m PyInstaller \
|
|
--clean \
|
|
--onefile \
|
|
--paths src \
|
|
--name wallpaper_changer \
|
|
main.py
|
|
|
|
- name: Build wheel
|
|
working-directory: wallpaper_changer
|
|
run: |
|
|
python -m build --wheel
|
|
|
|
- name: Verify build outputs
|
|
run: |
|
|
ls -lh wallpaper_changer/dist/
|
|
test -f wallpaper_changer/dist/wallpaper_changer
|
|
ls wallpaper_changer/dist/*.whl
|
|
|
|
- name: Upload build artifacts
|
|
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
|
with:
|
|
name: wallpaper-changer-build
|
|
path: wallpaper_changer/dist/
|
|
if-no-files-found: error
|