Skip to content

Commit 8f0b229

Browse files
authored
Update CI/CD workflows (#125)
* Update CI/CD workflows * Extract all shared CI steps into a single action * Add missing newline * Adjust lint stage name so it's actually discernable in GH web UI * Move actions/checkout back * Uncomment commented steps * Revert step name change
1 parent 505b724 commit 8f0b229

6 files changed

Lines changed: 48 additions & 53 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Set up SDK environment
2+
description: Perform all the shared setup steps
3+
4+
inputs:
5+
python-version:
6+
description: Python version used for this run
7+
required: true
8+
deps-group:
9+
description: Dependency groups passed to `uv sync --group`
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
16+
with:
17+
version: 0.11.6
18+
activate-environment: true
19+
python-version: ${{ inputs.python-version }}
20+
- name: Install dependencies from the ${{ inputs.deps-group }} group(s)
21+
run: SDK_DEPS_GROUP="${{ inputs.deps-group }}" make uv-sync-ci
22+
shell: bash

.github/workflows/lint.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
name: Python SDK CI
1+
name: Python SDK Lint
22
on: [push, workflow_dispatch]
33

44
jobs:
55
lint-stage:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
9-
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
9+
- uses: ./.github/actions/setup-sdk-environment
1010
with:
11-
activate-environment: true
11+
python-version: ${{ matrix.python-version }}
12+
deps-group: lint
1213
- name: Verify uv.lock is up-to-date
1314
run: uv lock --check
14-
- name: Install dependencies with uv
15-
run: SDK_DEPS_GROUP="lint" make uv-sync-ci
16-
- name: Verify basedpyright baseline
15+
- name: Verify against basedpyright baseline
1716
run: uv run --frozen basedpyright

.github/workflows/pre-release.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,21 @@ name: Publish SDK to Test PyPI
22
on: [workflow_dispatch]
33

44
env:
5-
PYTHON_VERSION: 3.9
5+
PYTHON_VERSION: 3.13
66

77
jobs:
8-
publish-sdk-test-pypi:
8+
publish-to-test-pypi:
99
runs-on: ubuntu-latest
1010
permissions:
1111
id-token: write
1212
environment:
1313
name: splunk-test-pypi
1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
17-
- name: Setup Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
16+
- uses: ./.github/actions/setup-sdk-environment
1917
with:
20-
python-version: ${{ matrix.python-version }}
21-
cache: pip
22-
- name: Setup uv
23-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
24-
with:
25-
activate-environment: true
26-
enable-cache: true
27-
- name: Install dependencies
28-
run: SDK_DEPS_GROUP="release" make uv-sync-ci
18+
python-version: ${{ env.PYTHON_VERSION }}
19+
deps-group: release
2920
- name: Build packages for distribution
3021
run: uv build
3122
- name: Publish packages to Test PyPI

.github/workflows/release.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,28 @@ env:
77
PYTHON_VERSION: 3.13
88

99
jobs:
10-
publish-sdk-pypi:
10+
publish-to-pypi:
1111
runs-on: ubuntu-latest
1212
permissions:
1313
id-token: write
1414
environment:
1515
name: splunk-pypi
1616
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19-
- name: Setup Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18+
- uses: ./.github/actions/setup-sdk-environment
2119
with:
22-
python-version: ${{ matrix.python-version }}
23-
cache: pip
24-
- name: Setup uv
25-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
26-
with:
27-
activate-environment: true
28-
enable-cache: true
29-
- name: Install dependencies
30-
run: SDK_DEPS_GROUP="release" make uv-sync-ci
20+
python-version: ${{ env.PYTHON_VERSION }}
21+
deps-group: release
3122
- name: Build packages for distribution
3223
run: uv build
3324
- name: Publish packages to PyPI
34-
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
25+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
26+
with:
27+
repository-url: https://test.pypi.org/legacy/
3528
- name: Generate API reference
3629
run: make -C ./docs html
3730
- name: Upload docs artifact
38-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
31+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
3932
with:
4033
name: python-sdk-docs
4134
path: docs/_build/html

.github/workflows/test.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,11 @@ jobs:
1414
python-version: [3.13]
1515
splunk-version: [latest]
1616
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19-
- name: Setup Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18+
- uses: ./.github/actions/setup-sdk-environment
2119
with:
2220
python-version: ${{ matrix.python-version }}
23-
cache: pip
24-
- name: Setup uv
25-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
26-
with:
27-
activate-environment: true
28-
enable-cache: true
29-
- name: Install dependencies
30-
run: SDK_DEPS_GROUP="test" make uv-sync-ci
21+
deps-group: test
3122
- name: Download Splunk MCP Server App
3223
run: uv run ./scripts/download_splunk_mcp_server_app.py
3324
env:
@@ -50,10 +41,9 @@ jobs:
5041
INTERNAL_AI_CLIENT_SECRET: ${{ secrets.INTERNAL_AI_CLIENT_SECRET }}
5142
INTERNAL_AI_TOKEN_URL: ${{ secrets.INTERNAL_AI_TOKEN_URL }}
5243
INTERNAL_AI_BASE_URL: ${{ secrets.INTERNAL_AI_BASE_URL }}
53-
5444
- name: Restore pytest cache
55-
if: ${{ github.ref }} != "refs/heads/master" && ${{ github.ref }} != "refs/heads/develop"
56-
uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c
45+
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }}
46+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
5747
with:
5848
path: .pytest_cache
5949
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ html:
1111
sphinx-build -b html -d $(BUILDDIR)/doctrees . $(HTMLDIR)
1212
sh munge_links.sh $(HTMLDIR)
1313
@echo "[splunk-sdk] ---"
14-
@echo "[splunk-sdk] Build finished. HTML pages available at docs/$(HTMLDIR)."
14+
@echo "[splunk-sdk] Build finished. HTML pages available at docs/$(HTMLDIR)."

0 commit comments

Comments
 (0)