diff --git a/.github/workflows/devops.yml b/.github/workflows/devops.yml index 2cc5749..8fc54e7 100644 --- a/.github/workflows/devops.yml +++ b/.github/workflows/devops.yml @@ -2,7 +2,7 @@ name: DevOps on: [push, pull_request] env: - pythonLastVersion: '3.11' + pythonLastVersion: '3.12' GHCR_REGISTRY: ghcr.io IMAGE_NAME: llaumgui/seedboxsync @@ -25,17 +25,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }} + cache: 'pip' - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-dev.txt + run: pip install -r requirements-dev.txt - name: Make all tests with make - run: make test + 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 @@ -52,6 +53,7 @@ jobs: files: "*.md docs/*.md" config_file: ".markdownlint.yaml" + ############################################################################## # Dockerfile tests # @@ -67,6 +69,7 @@ jobs: with: recursive: true + ############################################################################## # SonarCloud job # @@ -84,6 +87,12 @@ jobs: 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 }} + path: coverage.xml + - name: Display structure of downloaded files + run: ls -R - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@master env: @@ -93,6 +102,7 @@ jobs: args: > -Dsonar.verbose=true + ############################################################################## # Package job # @@ -109,15 +119,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ env.pythonLastVersion }} - - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }} + cache: 'pip' - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-dev.txt + run: pip install -r requirements-dev.txt - name: Package run: make dist - name: Archive package @@ -126,6 +130,7 @@ jobs: name: seedboxsync-${{ github.sha }}.tar.gz path: dist/*.tar.gz + ############################################################################## # Build and tests Docker image # @@ -170,6 +175,7 @@ jobs: with: sarif_file: 'trivy-results.sarif' + ############################################################################## # Build and deploy job (only on main) # @@ -235,6 +241,7 @@ jobs: cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest cache-to: type=inline + ############################################################################## # Release job # @@ -254,15 +261,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ env.pythonLastVersion }} - - uses: actions/cache@v4 - with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }} + cache: 'pip' - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-dev.txt + run: pip install -r requirements-dev.txt - name: Package run: make dist - name: Create GitHub release diff --git a/sonar-project.properties b/sonar-project.properties index 0d7ec96..265d51a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,7 +5,7 @@ sonar.projectName=SeedboxSync sonar.version=3.0.1 # Project URLs -sonar.host.url=https://sonarcloud.io/dashboard?id=llaumgui%3Aseedboxsync +sonar.host.url=https://sonarcloud.io/project/overview?id=llaumgui_seedboxsync sonar.links.homepage=https://github.com/llaumgui/seedboxsync sonar.links.ci=https://github.com/llaumgui/seedboxsync/actions sonar.links.issue=https://github.com/llaumgui/seedboxsync/issues @@ -14,5 +14,4 @@ sonar.links.issue=https://github.com/llaumgui/seedboxsync/issues sonar.sources=seedboxsync sonar.tests=tests sonar.exclusions=tests/**/*,docs/**/* -sonar.python.xunit.reportPath=coverage-report/pytest-report.xml sonar.python.coverage.reportPaths=coverage.xml