|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, master, develop] |
| 8 | + workflow_dispatch: |
| 9 | +# Uncomment to activate regular checks: |
| 10 | +# schedule: |
| 11 | +# - cron: "0 0 * * 0" # Weekly on Sundays |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Setup Rye |
| 22 | + id: setup-rye |
| 23 | + uses: eifinger/setup-rye@v4 |
| 24 | + with: |
| 25 | + enable-cache: true |
| 26 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + if: steps.setup-rye.outputs.cache-hit != 'true' |
| 30 | + run: make install |
| 31 | + |
| 32 | + - name: Cache pre-commit |
| 33 | + uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: ~/.cache/pre-commit |
| 36 | + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
| 37 | + |
| 38 | + - name: Run pre-commit checks |
| 39 | + run: make precommit |
| 40 | + |
| 41 | + - name: Lint |
| 42 | + run: make lint |
| 43 | + |
| 44 | + - name: Lint GitHub Actions |
| 45 | + uses: eifinger/actionlint-action@v1 |
| 46 | + |
| 47 | + test: |
| 48 | + name: Test Python |
| 49 | + needs: lint |
| 50 | + runs-on: ubuntu-latest |
| 51 | + strategy: |
| 52 | + matrix: |
| 53 | + python-version: ["3.12"] # Add additional versions as needed |
| 54 | + fail-fast: false |
| 55 | + steps: |
| 56 | + - name: Checkout repository |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Setup Rye |
| 60 | + id: setup-rye |
| 61 | + uses: eifinger/setup-rye@v4 |
| 62 | + with: |
| 63 | + enable-cache: true |
| 64 | + cache-prefix: ${{ matrix.python-version }} |
| 65 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Pin Python ${{ matrix.python-version }} |
| 68 | + run: rye pin ${{ matrix.python-version }} |
| 69 | + |
| 70 | + - name: Install dependencies |
| 71 | + if: steps.setup-rye.outputs.cache-hit != 'true' |
| 72 | + run: make install |
| 73 | + |
| 74 | + - name: Run tests with coverage |
| 75 | + run: make test |
| 76 | + |
| 77 | + - name: Upload coverage report as artifact |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: coverage-report-${{ matrix.python-version }} |
| 81 | + path: | |
| 82 | + htmlcov/ |
| 83 | + coverage.xml |
| 84 | + retention-days: 7 |
| 85 | + |
| 86 | + greeting: |
| 87 | + name: Greet first-time contributors |
| 88 | + runs-on: ubuntu-latest |
| 89 | + if: github.event_name == 'pull_request' || github.event_name == 'issues' |
| 90 | + steps: |
| 91 | + - uses: actions/first-interaction@v1 |
| 92 | + with: |
| 93 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + pr-message: 'Hello @${{ github.actor }}, thank you for submitting a PR! We will review it soon.' |
| 95 | + issue-message: | |
| 96 | + Hello @${{ github.actor }}, thank you for your interest in our project! |
| 97 | + If this is a bug report, please provide screenshots and steps to reproduce your issue. |
0 commit comments