ci(ffmpeg_handling): add main restriction for build task #2
@@ -0,0 +1,105 @@
|
||||
name: FFmpeg Handling CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "ffmpeg_handling/**"
|
||||
- "serverlibrary/**"
|
||||
- ".gitea/workflows/ffmpeg_handling.yaml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "ffmpeg_handling/**"
|
||||
- "serverlibrary/**"
|
||||
- ".gitea/workflows/ffmpeg_handling.yaml"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||
|
||||
steps:
|
||||
- name: Check out the tested commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install FFmpeg
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install --yes --no-install-recommends ffmpeg
|
||||
|
||||
- name: Install ffmpeg_handling
|
||||
working-directory: ffmpeg_handling
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ../serverlibrary .
|
||||
|
||||
- name: Run tests
|
||||
working-directory: ffmpeg_handling
|
||||
run: python src/ffmpeg_handling/run_test.py
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||
|
||||
steps:
|
||||
- name: Check out the tested commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Ruff
|
||||
run: python -m pip install ruff
|
||||
|
||||
- name: Lint ffmpeg_handling
|
||||
run: ruff check ffmpeg_handling/src ffmpeg_handling/tests ffmpeg_handling/main.py
|
||||
|
||||
build:
|
||||
needs: [test, lint]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: nikolaik/python-nodejs:python3.12-nodejs20
|
||||
|
||||
steps:
|
||||
- name: Check out the tested commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
working-directory: ffmpeg_handling
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ../serverlibrary .
|
||||
python -m pip install pyinstaller
|
||||
|
||||
- name: Build one-file executable
|
||||
working-directory: ffmpeg_handling
|
||||
run: python -m PyInstaller --clean --noconfirm ffmpeg_handling.spec
|
||||
|
||||
- name: Verify executable
|
||||
run: test -x ffmpeg_handling/dist/ffmpeg_handling
|
||||
|
||||
- name: Upload executable
|
||||
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: ffmpeg-handling-build
|
||||
path: ffmpeg_handling/dist/ffmpeg_handling
|
||||
if-no-files-found: error
|
||||
|
||||
install:
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
needs: build
|
||||
runs-on: [self-hosted, linux, x64]
|
||||
|
||||
steps:
|
||||
- name: Download executable
|
||||
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
name: ffmpeg-handling-build
|
||||
path: dist/
|
||||
|
||||
- name: Install ffmpeg_handling
|
||||
run: |
|
||||
set -euo pipefail
|
||||
install -d -m 755 "$HOME/tools"
|
||||
install -m 755 dist/ffmpeg_handling "$HOME/tools/ffmpeg_handling"
|
||||
Reference in new issue
Block a user