Skip to content

Commit c2899f8

Browse files
authored
Restructure Rust plugin monorepo and CI (#8)
* Restructure workspace and migrate rate_limiter Signed-off-by: lucarlig <luca.carlig@ibm.com> * Add the pii_filter managed plugin Signed-off-by: lucarlig <luca.carlig@ibm.com> * Add shared plugin tooling and CI workflows Signed-off-by: lucarlig <luca.carlig@ibm.com> * Restore rate limiter release wheel matrix Signed-off-by: lucarlig <luca.carlig@ibm.com> * Fix pii_filter review findings Signed-off-by: lucarlig <luca.carlig@ibm.com> * Fix stale stub path in CI test Signed-off-by: lucarlig <luca.carlig@ibm.com> --------- Signed-off-by: lucarlig <luca.carlig@ibm.com>
1 parent 494996f commit c2899f8

78 files changed

Lines changed: 8972 additions & 1568 deletions

Some content is hidden

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

.github/workflows/ci-rate-limiter.yaml

Lines changed: 0 additions & 123 deletions
This file was deleted.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI Rust Python Package Plugins
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "Makefile"
8+
- "Cargo.toml"
9+
- "Cargo.lock"
10+
- "crates/**"
11+
- "README.md"
12+
- "DEVELOPING.md"
13+
- "TESTING.md"
14+
- "plugins/rust/python-package/**"
15+
- "tests/**"
16+
- "tools/**"
17+
- ".github/workflows/ci-rust-python-package.yaml"
18+
- ".github/workflows/release-rust-python-package.yaml"
19+
pull_request:
20+
branches: [main]
21+
paths:
22+
- "Makefile"
23+
- "Cargo.toml"
24+
- "Cargo.lock"
25+
- "crates/**"
26+
- "README.md"
27+
- "DEVELOPING.md"
28+
- "TESTING.md"
29+
- "plugins/rust/python-package/**"
30+
- "tests/**"
31+
- "tools/**"
32+
- ".github/workflows/ci-rust-python-package.yaml"
33+
- ".github/workflows/release-rust-python-package.yaml"
34+
35+
concurrency:
36+
group: ci-rust-python-package-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}
37+
cancel-in-progress: true
38+
39+
permissions:
40+
contents: read
41+
pull-requests: read
42+
43+
jobs:
44+
validate-and-detect:
45+
runs-on: ubuntu-latest
46+
outputs:
47+
plugins: ${{ steps.detect.outputs.plugins }}
48+
has_plugins: ${{ steps.detect.outputs.has_plugins }}
49+
steps:
50+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
51+
with:
52+
fetch-depth: 0
53+
54+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
55+
with:
56+
python-version: "3.12"
57+
58+
- name: Run catalog tests
59+
run: python3 -m unittest tests/test_plugin_catalog.py tests/test_install_built_wheel.py
60+
61+
- id: detect
62+
shell: bash
63+
run: |
64+
set -euo pipefail
65+
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
66+
selection="$(python3 tools/plugin_catalog.py ci-selection . diff "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")"
67+
elif [[ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]]; then
68+
selection="$(python3 tools/plugin_catalog.py ci-selection . all '' '')"
69+
else
70+
selection="$(python3 tools/plugin_catalog.py ci-selection . diff "${{ github.event.before }}" "${{ github.sha }}")"
71+
fi
72+
73+
plugins="$(printf '%s' "${selection}" | python3 -c 'import json, sys; print(json.dumps(json.load(sys.stdin)["plugins"]))')"
74+
has_plugins="$(printf '%s' "${selection}" | python3 -c 'import json, sys; print(str(json.load(sys.stdin)["has_plugins"]).lower())')"
75+
echo "plugins=${plugins}" >> "$GITHUB_OUTPUT"
76+
if [[ "${has_plugins}" == "false" ]]; then
77+
echo "has_plugins=false" >> "$GITHUB_OUTPUT"
78+
else
79+
echo "has_plugins=true" >> "$GITHUB_OUTPUT"
80+
fi
81+
82+
build-test:
83+
needs: validate-and-detect
84+
if: needs.validate-and-detect.outputs.has_plugins == 'true'
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
os: [ubuntu-latest, macos-latest, windows-latest]
89+
plugin: ${{ fromJson(needs.validate-and-detect.outputs.plugins) }}
90+
runs-on: ${{ matrix.os }}
91+
defaults:
92+
run:
93+
shell: bash
94+
steps:
95+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
96+
97+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
98+
with:
99+
python-version: "3.12"
100+
101+
- name: Verify Rust toolchain
102+
run: |
103+
rustc --version
104+
cargo --version
105+
106+
- name: Install uv
107+
run: python -m pip install uv==0.9.30 maturin==1.12.6
108+
109+
- name: Sync plugin environment
110+
working-directory: plugins/rust/python-package/${{ matrix.plugin }}
111+
run: make sync
112+
113+
- name: Plugin CI verification
114+
working-directory: plugins/rust/python-package/${{ matrix.plugin }}
115+
run: make ci

0 commit comments

Comments
 (0)