fix workflow #51
This file contains hidden or 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
| # SPDX-FileCopyrightText: 2026 German Aerospace Center (DLR) | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Tests | |
| on: | |
| - push | |
| - pull_request | |
| - workflow_dispatch | |
| env: | |
| # Python | |
| PYTHON_VERSION: "3.10" | |
| # Caching | |
| UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv | |
| PREK_HOME: ${{ github.workspace }}/.cache/prek | |
| # PyTorch CPU | |
| PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu | |
| UV_EXTRA_INDEX_URL: pytorch=https://download.pytorch.org/whl/cpu | |
| jobs: | |
| # ## PRE BUILD ############################################################## | |
| pre-commit: | |
| name: Pre-commit checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: j178/prek-action@v2 | |
| # ## BUILD PROJECT AND CACHE ################################################ | |
| build: | |
| name: Build and cache project | |
| runs-on: ubuntu-latest | |
| needs: [pre-commit] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| # ## LINTER AND STATIC CHECKS ############################################### | |
| ruff-lint: | |
| name: Ruff linter | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Test source code | |
| run: uv run ruff check src | |
| # - name: Test test code | |
| # run: uv run ruff check tests | |
| - name: Test test scripts | |
| run: | | |
| if [[ -n $(find scripts -name "*.py[i]" -print -quit) ]]; then | |
| uv run ruff check scripts | |
| fi | |
| ruff-format: | |
| name: Ruff formatter | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Test source code | |
| run: uv run ruff format --diff src | |
| # - name: Test test code | |
| # run: uv run ruff format --diff tests | |
| - name: Test test scripts | |
| run: | | |
| if [[ -n $(find scripts -name "*.py[i]" -print -quit) ]]; then | |
| uv run ruff format --diff scripts | |
| fi | |
| ty: | |
| name: Type Checker (ty) | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Test source code | |
| run: uv run ty check src | |
| # - name: Test test code | |
| # run: uv run ty check tests | |
| - name: Test test scripts | |
| run: | | |
| if [[ -n $(find scripts -name "*.py[i]" -print -quit) ]]; then | |
| uv run ty check scripts | |
| fi | |
| pylint: | |
| name: Static code analysis (pylint) | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Run pylint | |
| run: uv run pylint --fail-under=1 src | |
| # run: uv run pylint --fail-under=8 src | |
| typos: | |
| name: Typo check (typos) | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Typo check | |
| run: uv run typos | |
| shellcheck: | |
| name: ShellCheck | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install ShellCheck | |
| run: | | |
| version="stable" # or "v0.4.7", or "latest" | |
| wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${version?}/shellcheck-${version?}.linux.x86_64.tar.xz" | tar -xJv | |
| cp "shellcheck-${version}/shellcheck" ./shellcheck | |
| rm -rf "shellcheck-${version}" | |
| ./shellcheck --version | |
| - name: Run ShellCheck | |
| run: | | |
| find scripts -type f -name "*.sh" -exec ./shellcheck --external-sources --shell bash --source-path scripts {} + | |
| mdlint: | |
| name: Markdown lint | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run markdownlint | |
| uses: DavidAnson/markdownlint-cli2-action@v23 | |
| with: | |
| globs: | | |
| README.md | |
| docs/**/*.md | |
| licensecheck: | |
| name: License checks | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Check licenses | |
| run: uv run licensecheck | |
| reuse: | |
| name: Reuse check | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Check reuse information | |
| run: uv tool run reuse lint | |
| vulnerability: | |
| name: Dependency audit | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Dependency audit | |
| run: uv audit | |
| # ## DOCUMENTATION ########################################################## | |
| documentation: | |
| name: Build documentation | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - ruff-lint | |
| - ruff-format | |
| - ty | |
| - pylint | |
| - typos | |
| - shellcheck | |
| - mdlint | |
| - licensecheck | |
| - reuse | |
| - vulnerability | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "${{ env.PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Download coverage report artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: Python ${{ env.PYTHON_VERSION }} - HTML coverage report | |
| path: build/htmlcov | |
| - name: Build documentation | |
| env: | |
| DEPLOY: true | |
| run: uv run mkdocs build | |
| - name: Fix permissions | |
| run: | | |
| chmod -c -R +rX "site/" | while read line; do | |
| echo "::warning title=Invalid file permissions automatically fixed::$line" | |
| done | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: site | |
| # ## DEPLOY ################################################################# | |
| pages: | |
| name: Publish GitHub Pages | |
| if: ${{ contains(github.ref, 'main') && github.event.repository.visibility == 'public' }} | |
| needs: [documentation] | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |