106 lines
2.9 KiB
YAML
106 lines
2.9 KiB
YAML
name: Find Duplicates CI
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- main
|
|
paths:
|
|
- "find_duplicates/**"
|
|
- ".gitea/workflows/find_duplicates.yaml"
|
|
pull_request:
|
|
branches:
|
|
- dev
|
|
paths:
|
|
- "find_duplicates/**"
|
|
- ".gitea/workflows/find_duplicates.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 dependencies
|
|
run: python -m pip install -r find_duplicates/requirements.txt
|
|
|
|
- name: Run tests
|
|
run: python -m unittest discover -s find_duplicates -p "test_*.py" -v
|
|
|
|
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 find_duplicates
|
|
run: ruff check --select E,F,I --line-length 120 find_duplicates
|
|
|
|
build:
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
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
|
|
run: |
|
|
python -m pip install -r find_duplicates/requirements.txt
|
|
python -m pip install pyinstaller
|
|
|
|
- name: Build one-file executable
|
|
working-directory: find_duplicates
|
|
run: python -m PyInstaller --clean --noconfirm --onefile --name find_duplicates find_duplicates.py
|
|
|
|
- name: Verify executable
|
|
run: |
|
|
test -x find_duplicates/dist/find_duplicates
|
|
FIND_DUPLICATES_EXECUTABLE="$PWD/find_duplicates/dist/find_duplicates" \
|
|
python -m unittest discover -s find_duplicates -p "test_*.py" -v
|
|
|
|
- name: Upload executable
|
|
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
|
with:
|
|
name: find-duplicates-build
|
|
path: find_duplicates/dist/find_duplicates
|
|
if-no-files-found: error
|
|
|
|
install:
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
needs: build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runner:
|
|
- vivohost
|
|
- quiethost
|
|
- serverhost
|
|
- mediahost
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- name: Download executable
|
|
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
|
with:
|
|
name: find-duplicates-build
|
|
path: dist/
|
|
|
|
- name: Install find_duplicates
|
|
run: |
|
|
set -euo pipefail
|
|
install -d -m 755 "$HOME/tools"
|
|
install -m 755 dist/find_duplicates "$HOME/tools/find_duplicates"
|