Skip to content

Commit f182532

Browse files
committed
chore: initial commit
0 parents  commit f182532

File tree

86 files changed

+11215
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+11215
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
**Describe the bug**
8+
A clear and concise description of what the bug is.
9+
10+
**To Reproduce**
11+
Steps to reproduce the behavior:
12+
1. Implement X in a processor
13+
2. Make request with format '....'
14+
3. See error
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Your environment**
20+
* Version of the repo - a specific commit or tag
21+
* Version of SDK
22+
* Version of executing environment (e.g. Python)
23+
* OS and distribution
24+
* Details about containerization or virtualization environment
25+
26+
**Additional context**
27+
Add any other context about the problem here. Any log files you want to share.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
7+
**Is your feature request related to a problem? Please describe.**
8+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Proposed changes
2+
Describe the use case and detail of the change. If this PR addresses an issue
3+
on GitHub, make sure to include a link to that issue here in this description
4+
(not in the title of the PR).
5+
6+
### Checklist
7+
Before creating a PR, run through this checklist and mark each as complete.
8+
9+
- [ ] I have written my commit messages in the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
10+
- [ ] I have read the [CONTRIBUTING](/CONTRIBUTING.md) doc
11+
- [ ] I have added tests (when possible) that prove my fix is effective or that my feature works
12+
- [ ] I have checked that all unit tests pass after adding my changes
13+
- [ ] I have updated necessary documentation
14+
- [ ] I have rebased my branch onto master
15+
- [ ] I will ensure my PR is targeting the master branch and pulling from my branch from my own fork

.github/data/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG IMAGE="python:3.12-slim"
2+
3+
FROM ${IMAGE}
4+
5+
RUN --mount=type=bind,source=dist,target=/dist \
6+
pip3 install $(find /dist -name '*.whl' -print -quit)

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
groups:
8+
actions:
9+
update-types:
10+
- "major"
11+
- "minor"
12+
- "patch"

.github/workflows/ci.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "[0-9]+.[0-9]+.[0-9]+"
10+
workflow_dispatch:
11+
inputs:
12+
force_publish_pypi:
13+
description: "Bypass check to see if action is run on tag and attempt to publish"
14+
type: boolean
15+
default: false
16+
override_uv_version:
17+
description: "Build with a specific version"
18+
type: string
19+
default: ""
20+
ref:
21+
description: "ref to run CI against, if different than selected branch"
22+
type: string
23+
default: ""
24+
25+
permissions:
26+
contents: write
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
with:
35+
ref: ${{ inputs.ref || github.ref }}
36+
fetch-depth: 0
37+
38+
- name: Read .tool-versions
39+
uses: marocchino/tool-versions-action@18a164fa2b0db1cc1edf7305fcb17ace36d1c306 # v1.2.0
40+
id: versions
41+
42+
- name: Install a specific version of uv
43+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
44+
with:
45+
version: "${{ steps.versions.outputs.uv }}"
46+
python-version: "${{ steps.versions.outputs.python }}"
47+
enable-cache: true
48+
49+
- name: Install dependencies
50+
run: uv sync --frozen
51+
52+
- name: Test with pytest
53+
run: make test
54+
55+
- name: Archive test_logs
56+
if: always()
57+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
58+
with:
59+
name: test-logs
60+
path: test_logs/
61+
retention-days: 7
62+
63+
- name: Build wheels
64+
env:
65+
UV_DYNAMIC_VERSIONING_BYPASS: ${{ inputs.override_uv_version }}
66+
run: uv build
67+
68+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
69+
with:
70+
name: sdk-build
71+
path: dist/
72+
retention-days: 1
73+
74+
verify-build:
75+
needs: [build]
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
version: ["3.11", "3.12", "3.13"]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
with:
84+
ref: ${{ inputs.ref || github.ref }}
85+
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
86+
with:
87+
name: sdk-build
88+
path: .github/data/dist/
89+
- name: verify download
90+
run: ls -la .github/data/dist/
91+
- uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
92+
with:
93+
context: .github/data/
94+
build-args: |
95+
IMAGE=python:${{ matrix.version }}-slim
96+
97+
release-build:
98+
if: ${{ (startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch') || inputs.force_publish_pypi }}
99+
needs: [verify-build]
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Check if version if valid for publishing
103+
if: ${{ inputs.force_publish_pypi && !startsWith(inputs.ref, 'refs/tags/') }}
104+
run: |
105+
VERSION=${{ inputs.override_uv_version }}
106+
if [ -z "${VAR}" ]; then
107+
echo "Version override not set, continuing... "
108+
elif ! $(echo "$VERSION" | grep -q '[a-zA-Z]'); then
109+
cat << EOF
110+
Version '${VERSION}' in pyproject.toml is major version.
111+
Force publishing is only supported for pre-release versions.
112+
Please create a tag in order to perform a release.
113+
See here for versioning information: https://packaging.python.org/en/latest/discussions/versioning/
114+
EOF
115+
exit 1
116+
else
117+
echo "Version '${VERSION}' in pyproject.toml is pre-release, continuing... "
118+
fi
119+
120+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
121+
with:
122+
ref: ${{ inputs.ref || github.ref }}
123+
124+
- name: Read .tool-versions
125+
uses: marocchino/tool-versions-action@18a164fa2b0db1cc1edf7305fcb17ace36d1c306 # v1.2.0
126+
id: versions
127+
128+
- name: Install a specific version of uv
129+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
130+
with:
131+
version: "${{ steps.versions.outputs.uv }}"
132+
python-version: "${{ steps.versions.outputs.python }}"
133+
enable-cache: true
134+
135+
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
136+
with:
137+
name: sdk-build
138+
path: dist/
139+
- name: Create release and upload assets
140+
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch' }}
141+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
142+
with:
143+
files: dist/f5_ai_gateway_sdk*
144+
generate_release_notes: true
145+
146+
- name: Publish to Artifactory
147+
if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.force_publish_pypi }}
148+
run: |
149+
mkdir -p ~/.config/uv
150+
cat <<EOF > ~/.config/uv/uv.toml
151+
[[index]]
152+
name = "f5-artifactory"
153+
url = "https://${{ secrets.ARTIFACTORY_HOST }}/artifactory/api/pypi/f5-aigw-pypi/simple"
154+
publish-url = "https://${{ secrets.ARTIFACTORY_HOST }}/artifactory/api/pypi/f5-aigw-pypi"
155+
explicit = true
156+
EOF
157+
uv publish --index f5-artifactory --username ${{ secrets.ARTIFACTORY_USER }} --password ${{ secrets.ARTIFACTORY_PASSWORD }}

.github/workflows/f5-cla.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: F5 CLA
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
pull_request_target:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
13+
concurrency:
14+
group: ${{ github.ref_name }}-cla
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
f5-cla:
21+
name: F5 CLA
22+
runs-on: ubuntu-22.04
23+
permissions:
24+
actions: write
25+
contents: read
26+
pull-requests: write
27+
statuses: write
28+
steps:
29+
- name: Run F5 Contributor License Agreement (CLA) assistant
30+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the F5 CLA and agree to its terms') || github.event_name == 'pull_request_target'
31+
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
32+
with:
33+
# Any pull request targeting the following branch will trigger a CLA check.
34+
branch: "main"
35+
# Path to the CLA document.
36+
path-to-document: "https://github.com/f5/.github/blob/main/CLA/cla-markdown.md"
37+
# Custom CLA messages.
38+
custom-notsigned-prcomment: "🎉 Thank you for your contribution! It appears you have not yet signed the F5 Contributor License Agreement (CLA), which is required for your changes to be incorporated into an F5 Open Source Software (OSS) project. Please kindly read the [F5 CLA](https://github.com/f5/.github/blob/main/CLA/cla-markdown.md) and reply on a new comment with the following text to agree:"
39+
custom-pr-sign-comment: "I have hereby read the F5 CLA and agree to its terms"
40+
custom-allsigned-prcomment: "✅ All required contributors have signed the F5 CLA for this PR. Thank you!"
41+
# Remote repository storing CLA signatures.
42+
remote-organization-name: "f5"
43+
remote-repository-name: "f5-cla-data"
44+
path-to-signatures: "signatures/beta/signatures.json"
45+
# Comma separated list of usernames for maintainers or any other individuals who should not be prompted for a CLA.
46+
allowlist: "@nginxinc/aigw,bot*"
47+
# Do not lock PRs after a merge.
48+
lock-pullrequest-aftermerge: false
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
PERSONAL_ACCESS_TOKEN: ${{ secrets.F5_CLA_TOKEN }}

.github/workflows/linters.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: linters
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "[0-9]+.[0-9]+.[0-9]+"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code with full history
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
with:
19+
fetch-depth: 0
20+
21+
# Validate Python code follows coding standard
22+
- name: Read .tool-versions
23+
uses: marocchino/tool-versions-action@18a164fa2b0db1cc1edf7305fcb17ace36d1c306 # v1.2.0
24+
id: versions
25+
26+
- name: Install a specific version of uv
27+
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
28+
with:
29+
version: "${{ steps.versions.outputs.uv }}"
30+
python-version: "${{ steps.versions.outputs.python }}"
31+
enable-cache: true
32+
33+
- name: Install dependencies
34+
run: uv sync --frozen
35+
36+
- name: Lint with Ruff
37+
run: uv run ruff check --output-format=github .
38+
continue-on-error: false
39+
40+
- name: Check formatting with Ruff
41+
run: uv run ruff format --check .
42+
continue-on-error: false
43+
44+
- name: Type checking on src with Pyright
45+
run: uv run pyright ./src
46+
continue-on-error: false

0 commit comments

Comments
 (0)