add tools to clean orphaned files and export music library #291
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: Build | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
pull_request: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install hunspell | |
run: sudo apt-get install -y hunspell libhunspell-dev hunspell-en-us | |
- name: Lint with Ruff | |
run: | | |
pip install ruff | |
ruff check --output-format=github . | |
continue-on-error: true | |
- name: test | |
run: | | |
pip install -r requirements.txt | |
pip install -r dev_requirements.txt | |
python3 -c "import language_tool_python; tool = language_tool_python.LanguageTool('en')" | |
cd dvrprocess | |
pytest . --junitxml=../junit/test-results.xml --cov --cov-branch --cov-report=xml:../coverage.xml --cov-report=html:../htmlcov --cov-report=term-missing | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results | |
path: | | |
junit/test-results.xml | |
coverage.xml | |
htmlcov | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
build-and-push-image: | |
runs-on: ubuntu-22.04 | |
needs: [test] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
env: | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
labels: ${{ steps.meta.outputs.labels }} |