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