From 14f98f164b17f7207fff87b8eac491250f082cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20J=C4=99drecki?= Date: Fri, 10 Apr 2026 21:44:00 +0200 Subject: [PATCH] Upstream updates to some workflows --- .github/workflows/pre-release.yml | 15 +++++++--- .github/workflows/release.yml | 14 ++++++--- .github/workflows/test.yml | 50 ++++++++++++++++++------------- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 9c9bfef8..7baf3a37 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -12,16 +12,23 @@ jobs: environment: name: splunk-test-pypi steps: - - name: Checkout source + - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - - name: Set up Python ${{ env.PYTHON_VERSION }} + - name: Setup Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 with: python-version: ${{ env.PYTHON_VERSION }} + cache: pip + - name: Setup uv + uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 + with: + version: 0.11.6 + activate-environment: true + enable-cache: true - name: Install dependencies - run: python -m pip install . --group build + run: SDK_DEPS_GROUP="release" make uv-sync-ci - name: Build packages for distribution - run: python -m build + run: uv build - name: Publish packages to Test PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5514b8d8..23e16486 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,16 +14,22 @@ jobs: environment: name: splunk-pypi steps: - - name: Checkout source + - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - - name: Set up Python ${{ env.PYTHON_VERSION }} + - name: Setup Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 with: python-version: ${{ env.PYTHON_VERSION }} + cache: pip + - name: Setup uv + uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 + with: + activate-environment: true + enable-cache: true - name: Install dependencies - run: python -m pip install . --group release + run: SDK_DEPS_GROUP="release" make uv-sync-ci - name: Build packages for distribution - run: python -m build + run: uv build - name: Publish packages to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e - name: Generate API reference diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3de38452..411b6893 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,39 +1,49 @@ -name: Python CI -on: [push, workflow_dispatch] +name: Python SDK CI +on: + push: + branches: [master, develop] jobs: - run-test-suite: + test-stage: runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [ubuntu-latest] python-version: [3.9] splunk-version: [9.4, latest] include: - # Oldest possible configuration - # Last Ubuntu version with Python 3.7 binaries available - - os: ubuntu-22.04 - python-version: 3.7 - splunk-version: 9.1 - # Latest possible configuration - os: ubuntu-latest python-version: 3.13 splunk-version: latest steps: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - - name: Launch Splunk Docker instance - run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 with: python-version: ${{ matrix.python-version }} - - name: (Python 3.7) Install dependencies - if: ${{ matrix.python-version == '3.7' }} - run: python -m pip install python-dotenv pytest - - name: (Python >= 3.9) Install dependencies - if: ${{ matrix.python-version != '3.7' }} - run: python -m pip install . --group test - - name: Run entire test suite - run: python -m pytest ./tests + cache: pip + - name: Setup latest uv + uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 + with: + version: 0.11.6 + activate-environment: true + enable-cache: true + - name: Install Python dependencies + run: SDK_DEPS_GROUP="test" make uv-sync-ci + - name: Launch Splunk Docker instance + run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d + - name: Set up `.env` + run: cp .env.template .env + - name: Restore `pytest` cache + if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }} + uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c + with: + path: .pytest_cache + key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}- + - name: Run unit tests + run: make test-unit + - name: Run integration/system tests + run: make test-integration