Skip to content

Commit 29bf1ab

Browse files
authored
feat: Migrate slima2a to its own repo (#1)
This commit moves the slima2a code from the main slim repo into its own for better dependency and release management. Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
1 parent 8559c4e commit 29bf1ab

35 files changed

Lines changed: 4104 additions & 0 deletions
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
6+
name: Setup Python Environment
7+
description: setup environment to build/test/lint python applications
8+
inputs:
9+
py-install:
10+
description: 'Install Python'
11+
required: false
12+
default: 'false'
13+
py-version:
14+
description: 'Python version to install'
15+
required: false
16+
default: "3.12"
17+
poetry-install:
18+
description: 'Install poetry'
19+
required: false
20+
default: 'false'
21+
poetry-version:
22+
description: 'Poetry version to use'
23+
required: false
24+
default: "1.7.1"
25+
uv-install:
26+
description: 'Install uv'
27+
required: false
28+
default: 'true'
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Setup Python
34+
if: ${{ inputs.py-install == 'true' }}
35+
id: setup-python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ inputs.py-version }}
39+
40+
- name: Setup Taskfile
41+
uses: ./.github/actions/setup-task
42+
with:
43+
version: latest
44+
cache-enabled: true
45+
46+
- name: Load cached Poetry Binary
47+
if: ${{ inputs.poetry-install == 'true' }}
48+
uses: actions/cache@v4
49+
with:
50+
path: ~/.local
51+
key: venv-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-python.outputs.python-version }}-${{ inputs.poetry-version }}
52+
53+
- name: Install Poetry
54+
if: ${{ inputs.poetry-install == 'true' }}
55+
shell: bash
56+
run: |
57+
if [[ -f ~/.local/bin/poetry ]]; then
58+
echo "Poetry already installed"
59+
else
60+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ inputs.poetry-version }} python3 -
61+
fi
62+
63+
- name: Install uv (unix)
64+
if: ${{ inputs.uv-install == 'true' && runner.os != 'Windows' }}
65+
shell: bash
66+
run: |
67+
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="${HOME}/.local/bin" sh
68+
69+
- name: Install uv (windows)
70+
if: ${{ inputs.uv-install == 'true' && runner.os == 'Windows' }}
71+
shell: bash
72+
run: |
73+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
74+
75+
- name: Load cached venv
76+
if: ${{ inputs.poetry-install == 'true' }}
77+
uses: actions/cache@v4
78+
with:
79+
path: ~/.cache/pypoetry/virtualenvs
80+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
81+
82+
- name: Update GITHUB_PATH
83+
shell: bash
84+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
6+
name: Setup Task with Cache
7+
description: Setup Task (go-task/task) with GitHub Actions caching to prevent rate limiting
8+
inputs:
9+
version:
10+
description: 'Task version to install (e.g., "3.39.2", "latest")'
11+
required: false
12+
default: 'latest'
13+
cache-enabled:
14+
description: 'Enable caching of the Task binary'
15+
required: false
16+
default: 'true'
17+
github-token:
18+
description: 'GitHub token for API requests'
19+
required: false
20+
default: ${{ github.token }}
21+
22+
outputs:
23+
cache-hit:
24+
description: 'Whether the Task binary was retrieved from cache'
25+
value: ${{ steps.cache.outputs.cache-hit }}
26+
version:
27+
description: 'The actual version of Task that was installed'
28+
value: ${{ steps.get-version.outputs.version }}
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Determine Task version
34+
id: get-version
35+
shell: bash
36+
run: |
37+
if [ "${{ inputs.version }}" == "latest" ]; then
38+
echo "Fetching latest Task version (authenticated request)..."
39+
VERSION=$(curl -s -H "Authorization: Bearer ${{ inputs.github-token }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/go-task/task/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
40+
if [[ -z "$VERSION" ]]; then
41+
echo "Failed to fetch latest version via authenticated request, using fallback"
42+
VERSION="v3.39.2"
43+
fi
44+
else
45+
VERSION="${{ inputs.version }}"
46+
# Ensure version starts with 'v'
47+
if [[ ! "$VERSION" =~ ^v ]]; then
48+
VERSION="v$VERSION"
49+
fi
50+
fi
51+
echo "version=$VERSION" >> $GITHUB_OUTPUT
52+
echo "Using Task version: $VERSION"
53+
54+
- name: Determine platform
55+
id: platform
56+
shell: bash
57+
run: |
58+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
59+
ARCH=$(uname -m)
60+
61+
# Normalize architecture names to match Task releases
62+
case $ARCH in
63+
x86_64)
64+
ARCH="amd64"
65+
;;
66+
aarch64|arm64)
67+
ARCH="arm64"
68+
;;
69+
armv7l)
70+
ARCH="arm"
71+
;;
72+
esac
73+
74+
# Normalize OS names
75+
case $OS in
76+
darwin)
77+
OS="darwin"
78+
;;
79+
linux)
80+
OS="linux"
81+
;;
82+
mingw*|msys*|cygwin*)
83+
OS="windows"
84+
;;
85+
esac
86+
87+
# Determine Windows architecture naming
88+
[[ $OS == "windows" ]] && BINARY_NAME="task.exe" || BINARY_NAME="task"
89+
90+
echo "os=$OS" >> $GITHUB_OUTPUT
91+
echo "arch=$ARCH" >> $GITHUB_OUTPUT
92+
echo "binary_name=$BINARY_NAME" >> $GITHUB_OUTPUT
93+
echo "Platform: $OS-$ARCH"
94+
95+
- name: Setup GitHub PATH
96+
shell: bash
97+
run: |
98+
echo "Adding ~/.local/bin to PATH"
99+
echo "$HOME/.local/bin" >> $GITHUB_PATH
100+
101+
- name: Setup cache for Task binary
102+
id: cache
103+
if: inputs.cache-enabled == 'true'
104+
uses: actions/cache@v4
105+
with:
106+
# If windows, we need to cache task.exe
107+
path: ~/.local/bin/${{ steps.platform.outputs.binary_name }}
108+
key: task-${{ steps.get-version.outputs.version }}-${{ steps.platform.outputs.os }}-${{ steps.platform.outputs.arch }}
109+
110+
- name: Download and install Task
111+
if: steps.cache.outputs.cache-hit != 'true'
112+
shell: bash
113+
env:
114+
VERSION: ${{ steps.get-version.outputs.version }}
115+
OS: ${{ steps.platform.outputs.os }}
116+
ARCH: ${{ steps.platform.outputs.arch }}
117+
GITHUB_TOKEN: ${{ inputs.github-token }}
118+
run: |
119+
echo "Task not found in cache, downloading..."
120+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -b ~/.local/bin -d ${{ steps.get-version.outputs.version }}
121+
122+
- name: Verify installation
123+
shell: bash
124+
run: |
125+
# Verify installation
126+
if task --version; then
127+
echo "Task installation verified"
128+
else
129+
echo "Task installation verification failed"
130+
exit 1
131+
fi
132+
133+
- name: Cache status
134+
shell: bash
135+
run: |
136+
if [[ "${{ steps.cache.outputs.cache-hit }}" == "true" ]]; then
137+
echo "✓ Task binary retrieved from cache"
138+
else
139+
echo "✓ Task binary downloaded and cached for future runs"
140+
fi

.github/release-config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bump-patch-for-minor-pre-major": true,
3+
"separate-pull-requests": true,
4+
"sequential-calls": true,
5+
"include-component-in-tag": true,
6+
"skip-github-release": false,
7+
"signoff": "Agntcy Build Bot <build@agntcy.io>",
8+
"bump-minor-pre-major": true,
9+
"packages": {
10+
".": {
11+
"package-name": "slima2a",
12+
"release-type": "python"
13+
}
14+
}
15+
}

.github/release-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"slima2a": "0.2.2"
3+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: ci-build-and-test
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16+
17+
jobs:
18+
build-wheels:
19+
name: Build slim mcp
20+
uses: ./.github/workflows/reusable-python-build-and-test.yaml
21+
with:
22+
package: slima2a
23+
working-directory: .
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: ci-release-please-check
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
steps:
23+
- uses: googleapis/release-please-action@v4
24+
id: release-please
25+
with:
26+
token: ${{ secrets.AGNTCY_BUILD_BOT_GH_TOKEN }}
27+
config-file: .github/release-config.json
28+
manifest-file: .github/release-manifest.json
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: ci-release-python
6+
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
build-wheels:
18+
name: Build slim mcp
19+
uses: ./.github/workflows/reusable-python-build-and-test.yaml
20+
with:
21+
working-directory: ./data-plane/python/integrations
22+
23+
pypi-publish:
24+
name: Upload release to PyPI
25+
runs-on: ubuntu-latest
26+
needs:
27+
- build-wheels
28+
environment: pypi
29+
permissions:
30+
# IMPORTANT: this permission is mandatory for Trusted Publishing
31+
id-token: write
32+
contents: read
33+
steps:
34+
- name: Download artifacts
35+
uses: actions/download-artifact@v4
36+
with:
37+
merge-multiple: true
38+
path: dist
39+
40+
- name: Show files
41+
run: ls -l dist
42+
43+
- name: Publish package distributions to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1
45+
with:
46+
password: ${{ secrets.PYPI_API_TOKEN }}
47+
packages-dir: dist

0 commit comments

Comments
 (0)