|
| 1 | +# SPDX-FileCopyrightText: 2025 German Aerospace Center (DLR) |
| 2 | +# SPDX-License-Identifier: CC0-1.0 |
| 3 | + |
| 4 | +name: Main |
| 5 | + |
| 6 | +on: |
| 7 | + - push |
| 8 | + - pull_request |
| 9 | + - workflow_dispatch |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + # ## BUILD PROJECT AND CACHE ################################################ |
| 14 | + |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Free Disk Space (Ubuntu) |
| 19 | + uses: BRAINSia/free-disk-space@v2 |
| 20 | + - uses: actions/checkout@v5 |
| 21 | + - uses: actions/setup-python@v6 |
| 22 | + with: |
| 23 | + python-version: '3.10' |
| 24 | + cache: pip |
| 25 | + - name: Install dependencies |
| 26 | + run: pip install -U -e ".[all]" |
| 27 | + |
| 28 | + # ## LINTER AND STATIC CHECKS ############################################### |
| 29 | + |
| 30 | + pre-commit: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + needs: [build] |
| 33 | + steps: |
| 34 | + - name: Free Disk Space (Ubuntu) |
| 35 | + uses: BRAINSia/free-disk-space@v2 |
| 36 | + - uses: actions/checkout@v5 |
| 37 | + - uses: actions/setup-python@v6 |
| 38 | + with: |
| 39 | + python-version: '3.10' |
| 40 | + cache: pip |
| 41 | + - name: Install dependencies |
| 42 | + run: pip install -U -e ".[all]" |
| 43 | + - uses: pre-commit/[email protected] |
| 44 | + |
| 45 | + ruff-formatter: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: [build] |
| 48 | + steps: |
| 49 | + - name: Free Disk Space (Ubuntu) |
| 50 | + uses: BRAINSia/free-disk-space@v2 |
| 51 | + - uses: actions/checkout@v5 |
| 52 | + - uses: actions/setup-python@v6 |
| 53 | + with: |
| 54 | + python-version: '3.10' |
| 55 | + cache: pip |
| 56 | + - name: Install dependencies |
| 57 | + run: pip install -U -e ".[all]" |
| 58 | + - name: Run ruff formatter checks |
| 59 | + run: python -m ruff format --diff slki |
| 60 | + |
| 61 | + ruff-linter: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: [build] |
| 64 | + steps: |
| 65 | + - name: Free Disk Space (Ubuntu) |
| 66 | + uses: BRAINSia/free-disk-space@v2 |
| 67 | + - uses: actions/checkout@v5 |
| 68 | + - uses: actions/setup-python@v6 |
| 69 | + with: |
| 70 | + python-version: '3.10' |
| 71 | + cache: pip |
| 72 | + - name: Install dependencies |
| 73 | + run: pip install -U -e ".[all]" |
| 74 | + - name: Run ruff linter checks |
| 75 | + run: python -m ruff check --output-format=github slki |
| 76 | + |
| 77 | + mypy: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: [build] |
| 80 | + steps: |
| 81 | + - name: Free Disk Space (Ubuntu) |
| 82 | + uses: BRAINSia/free-disk-space@v2 |
| 83 | + - uses: actions/checkout@v5 |
| 84 | + - uses: actions/setup-python@v6 |
| 85 | + with: |
| 86 | + python-version: '3.10' |
| 87 | + cache: pip |
| 88 | + - name: Install dependencies |
| 89 | + run: pip install -U -e ".[all]" |
| 90 | + - name: Run mypy checks |
| 91 | + run: python -m mypy slki |
| 92 | + |
| 93 | + shellcheck: |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: [build] |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v5 |
| 98 | + - name: Run ShellCheck |
| 99 | + run: find scripts -type f -name "*.sh" -exec shellcheck --external-sources --shell bash --source-path scripts {} + |
| 100 | + |
| 101 | + doc: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: [build] |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v5 |
| 106 | + - uses: DavidAnson/markdownlint-cli2-action@v20 |
| 107 | + with: |
| 108 | + globs: | |
| 109 | + README.md |
| 110 | + docs/**/*.md |
| 111 | +
|
| 112 | + license: |
| 113 | + runs-on: ubuntu-latest |
| 114 | + needs: [build] |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v5 |
| 117 | + - uses: actions/setup-python@v6 |
| 118 | + with: |
| 119 | + python-version: '3.10' |
| 120 | + - name: Install dependencies |
| 121 | + run: pip install -U licensecheck reuse |
| 122 | + - name: License check |
| 123 | + run: python -m licensecheck |
| 124 | + - name: Reuse check |
| 125 | + run: python -m reuse lint |
| 126 | + |
| 127 | + vulnerability: |
| 128 | + runs-on: ubuntu-latest |
| 129 | + needs: [build] |
| 130 | + steps: |
| 131 | + - name: Free Disk Space (Ubuntu) |
| 132 | + uses: BRAINSia/free-disk-space@v2 |
| 133 | + - uses: actions/checkout@v5 |
| 134 | + - uses: actions/setup-python@v6 |
| 135 | + with: |
| 136 | + python-version: '3.10' |
| 137 | + cache: pip |
| 138 | + - name: Install dependencies |
| 139 | + run: pip install -U tox~=4.26.0 |
| 140 | + - name: Vulnerability check |
| 141 | + run: python -m tox --recreate -e vulnerability |
| 142 | + |
| 143 | + # ## DOCUMENTATION ########################################################## |
| 144 | + |
| 145 | + documentation: |
| 146 | + runs-on: ubuntu-latest |
| 147 | + needs: [build, pre-commit, ruff-formatter, ruff-linter, mypy, shellcheck, doc, license, vulnerability] |
| 148 | + steps: |
| 149 | + - name: Free Disk Space (Ubuntu) |
| 150 | + uses: BRAINSia/free-disk-space@v2 |
| 151 | + - uses: actions/checkout@v5 |
| 152 | + - uses: actions/setup-python@v6 |
| 153 | + with: |
| 154 | + python-version: '3.10' |
| 155 | + cache: pip |
| 156 | + - name: Install dependencies |
| 157 | + run: pip install -U -e ".[all]" |
| 158 | + - name: Build documentation (GitHub Pages) |
| 159 | + env: |
| 160 | + DEPLOY: true |
| 161 | + run: python -m mkdocs build |
| 162 | + - name: Fix permissions |
| 163 | + run: | |
| 164 | + chmod -c -R +rX "site/" | while read line; do |
| 165 | + echo "::warning title=Invalid file permissions automatically fixed::$line" |
| 166 | + done |
| 167 | + - name: Upload Pages artifact |
| 168 | + uses: actions/upload-pages-artifact@v4 |
| 169 | + with: |
| 170 | + path: site |
| 171 | + |
| 172 | + # ## DEPLOY ################################################################# |
| 173 | + |
| 174 | + pages: |
| 175 | + if: ${{ contains(github.ref, 'main') || startsWith(github.ref, 'refs/tags/v') }} |
| 176 | + needs: [documentation] |
| 177 | + permissions: |
| 178 | + pages: write |
| 179 | + id-token: write |
| 180 | + environment: |
| 181 | + name: github-pages |
| 182 | + url: ${{ steps.deployment.outputs.page_url }} |
| 183 | + runs-on: ubuntu-latest |
| 184 | + steps: |
| 185 | + - name: Deploy to GitHub Pages |
| 186 | + id: deployment |
| 187 | + uses: actions/deploy-pages@v4 |
0 commit comments