|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [develop, main] |
| 6 | + push: |
| 7 | + branches: [develop, main] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ci-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + meta: |
| 18 | + name: Resolve versions |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + version: ${{ steps.meta.outputs.version }} |
| 22 | + sdk: ${{ steps.meta.outputs.sdk }} |
| 23 | + ruff: ${{ steps.meta.outputs.ruff }} |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v5 |
| 26 | + |
| 27 | + - uses: actions/setup-python@v6 |
| 28 | + with: |
| 29 | + python-version: '3.11' |
| 30 | + |
| 31 | + - name: Read pyproject.toml |
| 32 | + id: meta |
| 33 | + run: python scripts/release_meta.py >> "$GITHUB_OUTPUT" |
| 34 | + |
| 35 | + lint: |
| 36 | + name: Lint |
| 37 | + needs: meta |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v5 |
| 41 | + |
| 42 | + - uses: actions/setup-python@v6 |
| 43 | + with: |
| 44 | + python-version: '3.11' |
| 45 | + |
| 46 | + - name: Install ruff |
| 47 | + run: python -m pip install "${{ needs.meta.outputs.ruff }}" |
| 48 | + |
| 49 | + - name: Check formatting |
| 50 | + run: ruff format --check --diff . |
| 51 | + |
| 52 | + - name: Check lint rules |
| 53 | + run: ruff check --output-format github . |
| 54 | + |
| 55 | + changelog: |
| 56 | + name: Changelog |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v5 |
| 60 | + with: |
| 61 | + fetch-depth: 0 |
| 62 | + |
| 63 | + - uses: actions/setup-python@v6 |
| 64 | + with: |
| 65 | + python-version: '3.11' |
| 66 | + |
| 67 | + - name: Validate CHANGELOG.md structure |
| 68 | + run: python scripts/check_changelog.py |
| 69 | + |
| 70 | + - name: Require a changelog entry |
| 71 | + if: > |
| 72 | + github.event_name == 'pull_request' |
| 73 | + && !contains(github.event.pull_request.labels.*.name, 'no-changelog') |
| 74 | + run: | |
| 75 | + if ! git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qx CHANGELOG.md; then |
| 76 | + echo "This pull request does not touch CHANGELOG.md." |
| 77 | + echo "Add an entry under '## [Unreleased]' following CONTRIBUTING.md," |
| 78 | + echo "or label the pull request 'no-changelog' if the change is genuinely invisible to users." |
| 79 | + exit 1 |
| 80 | + fi |
| 81 | +
|
| 82 | + tests: |
| 83 | + name: Tests |
| 84 | + needs: meta |
| 85 | + runs-on: ubuntu-latest |
| 86 | + container: |
| 87 | + image: cubertgmbh/cuvis_pyil:${{ needs.meta.outputs.sdk }}-ubuntu24.04 |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v5 |
| 90 | + |
| 91 | + - name: Install the wrapper with test dependencies |
| 92 | + run: python3 -m pip install -e ".[test]" |
| 93 | + |
| 94 | + - name: Run tests |
| 95 | + run: python3 -m pytest |
0 commit comments