Skip to content

test

test #73

Workflow file for this run

name: DevOps
on:
[push, pull_request]
env:
pythonLastVersion: '3.12'
GHCR_REGISTRY: ghcr.io
IMAGE_NAME: llaumgui/seedboxsync
jobs:
##############################################################################
# Test python application
#
test_python:
runs-on: ubuntu-latest
name: Test Python
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: pip install -r requirements-dev.txt
- name: Make all tests with make
run: |
make comply
python -m pytest -v --cov=seedboxsync --cov-report=term --cov-report=xml --capture=sys tests/
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
##############################################################################
# Markdownlint
#
test_markdownlint:
runs-on: ubuntu-latest
name: MarkdownLint
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: "*.md docs/*.md"
config_file: ".markdownlint.yaml"
##############################################################################
# Dockerfile tests
#
test_dockerfiles:
if: ${{ github.event.schedule == '' }}
runs-on: ubuntu-latest
name: Linters for Dockerfile
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: hadolint
uses: hadolint/[email protected]
with:
recursive: true
##############################################################################
# SonarCloud job
#
test_sonar:
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
needs: [
test_python,
test_markdownlint,
test_dockerfiles
]
runs-on: ubuntu-latest
name: SonarCloud analyse
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/download-artifact@v4
with:
name: coverage-${{ env.pythonLastVersion }}
- name: Display structure of downloaded files
run: |
pwd
ls -R
cat coverage.xml
# Tempory fix: https://github.com/marketplace/actions/sonarcloud-scoverage-fix
- name: SonarCloud Scan
uses: pervasive-cats/[email protected]
#uses: sonarsource/sonarcloud-github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.verbose=true
##############################################################################
# Package job
#
package:
needs: [
test_sonar
]
runs-on: ubuntu-latest
name: Build package
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.pythonLastVersion }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.pythonLastVersion }}
cache: 'pip'
- name: Install Dependencies
run: pip install -r requirements-dev.txt
- name: Package
run: make dist
- name: Archive package
uses: actions/upload-artifact@v4
with:
name: seedboxsync-${{ github.sha }}.tar.gz
path: dist/*.tar.gz