|
1 | | -name: Python CI |
2 | | -on: [push, workflow_dispatch] |
| 1 | +name: Python SDK CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [master, develop] |
3 | 5 |
|
4 | 6 | jobs: |
5 | | - run-test-suite: |
| 7 | + test-stage: |
6 | 8 | runs-on: ${{ matrix.os }} |
7 | 9 | strategy: |
8 | | - fail-fast: false |
9 | 10 | matrix: |
10 | 11 | os: [ubuntu-latest] |
11 | 12 | python-version: [3.9] |
12 | 13 | splunk-version: [9.4, latest] |
13 | 14 | include: |
14 | | - # Oldest possible configuration |
15 | | - # Last Ubuntu version with Python 3.7 binaries available |
16 | | - - os: ubuntu-22.04 |
17 | | - python-version: 3.7 |
18 | | - splunk-version: 9.1 |
19 | | - # Latest possible configuration |
20 | 15 | - os: ubuntu-latest |
21 | 16 | python-version: 3.13 |
22 | 17 | splunk-version: latest |
23 | 18 | steps: |
24 | 19 | - name: Checkout code |
25 | 20 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
26 | | - - name: Launch Splunk Docker instance |
27 | | - run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d |
28 | 21 | - name: Setup Python ${{ matrix.python-version }} |
29 | 22 | uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 |
30 | 23 | with: |
31 | 24 | python-version: ${{ matrix.python-version }} |
32 | | - - name: (Python 3.7) Install dependencies |
33 | | - if: ${{ matrix.python-version == '3.7' }} |
34 | | - run: python -m pip install python-dotenv pytest |
35 | | - - name: (Python >= 3.9) Install dependencies |
36 | | - if: ${{ matrix.python-version != '3.7' }} |
37 | | - run: python -m pip install . --group test |
38 | | - - name: Run entire test suite |
39 | | - run: python -m pytest ./tests |
| 25 | + cache: pip |
| 26 | + - name: Setup latest uv |
| 27 | + uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 |
| 28 | + with: |
| 29 | + version: 0.11.6 |
| 30 | + activate-environment: true |
| 31 | + enable-cache: true |
| 32 | + - name: Install Python dependencies |
| 33 | + run: SDK_DEPS_GROUP="test" make uv-sync-ci |
| 34 | + - name: Launch Splunk Docker instance |
| 35 | + run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d |
| 36 | + - name: Set up `.env` |
| 37 | + run: cp .env.template .env |
| 38 | + - name: Restore `pytest` cache |
| 39 | + if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }} |
| 40 | + uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c |
| 41 | + with: |
| 42 | + path: .pytest_cache |
| 43 | + key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }} |
| 44 | + restore-keys: | |
| 45 | + pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}- |
| 46 | + - name: Run unit tests |
| 47 | + run: make test-unit |
| 48 | + - name: Run integration/system tests |
| 49 | + run: make test-integration |
0 commit comments