Skip to content

Commit afda27d

Browse files
committed
Adjust workflows once again, merge release workflows into a single source of truth
1 parent b3deb09 commit afda27d

8 files changed

Lines changed: 100 additions & 88 deletions

File tree

‎.github/workflows/appinspect.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
12+
with:
13+
persist-credentials: false
1214
- uses: ./.github/actions/setup-sdk-environment
1315
with:
1416
python-version: ${{ env.PYTHON_VERSION }}

‎.github/workflows/cd.yml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Python CD
2+
on:
3+
push:
4+
branches: [develop]
5+
release:
6+
types: [published]
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-distributables:
11+
# Why building is separate from publishing:
12+
# https://github.com/pypa/gh-action-pypi-publish/issues/217#issuecomment-1965727093
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
16+
with:
17+
persist-credentials: false
18+
- uses: ./.github/actions/setup-sdk-environment
19+
with:
20+
python-version: 3.13
21+
deps-group: release
22+
- name: Set pre-release version
23+
id: set-version
24+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
25+
run: |
26+
VERSION_BASE="$(uv version --short)"
27+
RUN_NUMBER="${{ github.run_number }}"
28+
COMMIT_SHA="$(git rev-parse --short HEAD)"
29+
uv version --frozen "${VERSION_BASE}.dev${RUN_NUMBER}+g${COMMIT_SHA}"
30+
- name: Build packages for distribution
31+
run: uv build
32+
- name: Run AppInspect
33+
uses: ./.github/actions/run-appinspect
34+
- name: Upload pre-release distributables
35+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
36+
with:
37+
name: splunk-sdk
38+
path: dist/
39+
- name: Generate API reference
40+
run: make -C ./docs html
41+
- name: Upload docs artifact
42+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
43+
with:
44+
name: python-sdk-docs
45+
path: docs/_build/html
46+
47+
publish-pre-release:
48+
if: startsWith(github.ref, 'refs/tags/') != true
49+
needs: build-release
50+
runs-on: ubuntu-latest
51+
permissions:
52+
id-token: write
53+
environment:
54+
name: splunk-test-pypi
55+
url: https://test.pypi.org/project/splunk-sdk/
56+
steps:
57+
- name: Download distributables
58+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
59+
with:
60+
name: splunk-sdk
61+
path: dist/
62+
- name: Publish packages to Test PyPI
63+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
64+
with:
65+
repository-url: https://test.pypi.org/legacy/
66+
67+
publish-release:
68+
if: startsWith(github.ref, 'refs/tags/')
69+
needs: build-release
70+
runs-on: ubuntu-latest
71+
permissions:
72+
id-token: write
73+
environment:
74+
name: splunk-pypi
75+
url: https://pypi.org/project/splunk-sdk/
76+
steps:
77+
- name: Download distributables
78+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
79+
with:
80+
name: splunk-sdk
81+
path: dist/
82+
- name: Publish packages to PyPI
83+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
84+
with:
85+
repository-url: https://pypi.org/legacy/

‎.github/workflows/lint.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
9+
with:
10+
persist-credentials: false
911
- uses: ./.github/actions/setup-sdk-environment
1012
with:
1113
python-version: ${{ matrix.python-version }}
1214
deps-group: lint
1315
- name: Verify uv.lock is up-to-date
1416
run: uv lock --check
1517
- name: Verify files are linted and formatted
16-
run: make ci-lint
18+
run: make ci-lint

‎.github/workflows/pre-release.yml‎

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎.github/workflows/release.yml‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎.github/workflows/test.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ concurrency:
77

88
jobs:
99
test:
10+
runs-on: ubuntu-latest
1011
strategy:
1112
matrix:
12-
os: [ubuntu-latest]
1313
python-version: [3.13]
1414
splunk-version: [latest]
15-
runs-on: ${{ matrix.os }}
1615
steps:
1716
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
17+
with:
18+
persist-credentials: false
1819
- uses: ./.github/actions/setup-sdk-environment
1920
with:
2021
python-version: ${{ matrix.python-version }}
@@ -46,7 +47,8 @@ jobs:
4647
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
4748
with:
4849
path: .pytest_cache
49-
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}
50+
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{
51+
github.sha }}
5052
restore-keys: |
5153
pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-
5254
- name: Run unit tests

‎AGENTS.md‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
This project uses [`uv`](https://docs.astral.sh/uv/) for dependency management and running Python tools. All Python and pytest invocations should be prefixed with `uv run`. Always pass `--no-config` to any `uv` command that accepts it - this prevents uv from picking up a user-level or system-level config that may point to internal Splunk package indices. To install/sync dependencies:
1212

1313
```sh
14-
make uv-sync
14+
make install
1515
```
1616

17-
If you manually edit `pyproject.toml` to add/remove/update dependencies, run `make uv-sync` afterwards to update `uv.lock`.
17+
If you manually edit `pyproject.toml` to add/remove/update dependencies, run `make install` afterwards to update `uv.lock`.
1818

1919
The `Makefile` wraps `uv` commands - prefer `make` targets over invoking `uv` directly where a target exists.
2020

2121
## Build, Test, and Development Commands
2222

2323
See the `Makefile` for all available targets. Common ones:
2424

25-
- `make uv-sync` - set up / update virtualenv
25+
- `make install` - set up / update virtualenv
2626
- `make test` - run the full pytest suite.
2727
- `make test-unit` - unit tests only; fastest feedback loop.
2828
- `make test-integration` - integration + system coverage; requires Splunk services available (see docker targets).
@@ -43,17 +43,12 @@ See the `Makefile` for all available targets. Common ones:
4343
**After editing any Python file**, format it:
4444

4545
```sh
46-
# Sort imports, then format
47-
uv run ruff check --fix $FILE
48-
uv run ruff format $FILE
46+
make lint
4947
```
5048

5149
**Before declaring a change done**, run:
5250

5351
```sh
54-
# linter
55-
uv run basedpyright
56-
5752
# testing
5853
make test-unit
5954
make test-ai

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ docker-splunk-restart:
116116

117117
.PHONY: docker-tail-python-log
118118
docker-tail-python-log:
119-
docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log
119+
docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log

0 commit comments

Comments
 (0)