build(CICD): split CICD in 2 files for serverlibrary and wallpaper_changer
This commit is contained in:
1 parent
7a5f062ca8
commit
a6063921e5
3 files changed
+155
-132
No files matched your search
@@ -1,132 +0,0 @@
|
|||||||
name: Python tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'wallpaper_changer/**'
|
|
||||||
- 'serverlibrary/**'
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'wallpaper_changer/**'
|
|
||||||
- 'serverlibrary/**'
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
name: Serverlibrary CI
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "serverlibrary/**"
|
||||||
|
- "wallpaper_changer/python/**"
|
||||||
|
- ".gitea/workflows/**"
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "serverlibrary/**"
|
||||||
|
- "wallpaper_changer/python/**"
|
||||||
|
- ".gitea/workflows/**"
|
||||||
|
|
||||||
|
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: Install serverlibrary
|
||||||
|
working-directory: serverlibrary
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install .
|
||||||
|
|
||||||
|
- name: Run serverlibrary tests
|
||||||
|
working-directory: serverlibrary
|
||||||
|
run: python run_tests.py
|
||||||
|
|
||||||
|
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: python -m pip install ruff
|
||||||
|
|
||||||
|
- name: Lint serverlibrary
|
||||||
|
run: ruff check serverlibrary/src serverlibrary/tests serverlibrary/run_tests.py
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
name: Wallpaper Changer CI
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows:
|
||||||
|
- Serverlibrary CI
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-wallpaper-changer:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the tested commit
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
|
||||||
|
- name: Install serverlibrary and wallpaper_changer
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install ../../serverlibrary
|
||||||
|
python -m pip install --group test .
|
||||||
|
|
||||||
|
- name: Run wallpaper_changer tests
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: python tests/run_tests.py all
|
||||||
|
|
||||||
|
lint-wallpaper-changer:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the tested commit
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
|
||||||
|
- name: Install Ruff
|
||||||
|
run: python -m pip install ruff
|
||||||
|
|
||||||
|
- name: Lint wallpaper_changer
|
||||||
|
run: ruff check wallpaper_changer/python
|
||||||
|
|
||||||
|
build:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
needs:
|
||||||
|
- test-wallpaper-changer
|
||||||
|
- lint-wallpaper-changer
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the tested commit
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install ../../serverlibrary
|
||||||
|
python -m pip install --group test .
|
||||||
|
python -m pip install build
|
||||||
|
|
||||||
|
- name: Build executable
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: |
|
||||||
|
python -m PyInstaller \
|
||||||
|
--clean \
|
||||||
|
--onefile \
|
||||||
|
--paths src \
|
||||||
|
--name wallpaper_changer \
|
||||||
|
main.py
|
||||||
|
|
||||||
|
- name: Build wheel
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: python -m build --wheel
|
||||||
|
|
||||||
|
- name: Verify build outputs
|
||||||
|
working-directory: wallpaper_changer/python
|
||||||
|
run: |
|
||||||
|
ls -lh dist/
|
||||||
|
test -f dist/wallpaper_changer
|
||||||
|
ls dist/*.whl
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wallpaper-changer-build
|
||||||
|
path: wallpaper_changer/python/dist/
|
||||||
|
if-no-files-found: error
|
||||||
Reference in new issue
Block a user