Skip to content

Commit b2f05c2

Browse files
committed
Add CCI validation
Signed-off-by: Uilian Ries <uilianr@jfrog.com>
1 parent 7017512 commit b2f05c2

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SAMPLE_RECIPES_NUM=10
6+
7+
# Find all conanfile.py files that use apply_conandata_patches
8+
RECIPES=$(find . -type f -name "conanfile.py" -exec grep "apply_conandata_patches(self)" {} + | sort | uniq | cut -d':' -f1)
9+
10+
echo "Found $(echo "$RECIPES" | wc -l) recipes using apply_conandata_patches."
11+
12+
# Pick 10 random recipes
13+
SAMPLE_RECIPES=$(shuf -e ${RECIPES[@]} -n $SAMPLE_RECIPES_NUM)
14+
15+
echo "Pick $SAMPLE_RECIPES_NUM random recipes to test:"
16+
echo "$SAMPLE_RECIPES"
17+
18+
# Run conan create for each sampled recipe
19+
for it in $SAMPLE_RECIPES; do
20+
recipe_dir=$(dirname "${it}")
21+
pushd "$recipe_dir"
22+
echo "Testing recipe in directory: ${recipe_dir}"
23+
# Get a version from conandata.yml that uses a patch
24+
version=$(yq '.patches | keys | .[0]' conandata.yml 2>/dev/null)
25+
if [ -z "$version" ]; then
26+
echo "ERROR: No patches found in conandata.yml for $recipe_dir, skipping."
27+
continue
28+
fi
29+
version=$(echo ${version} | tr -d '"')
30+
# Replace apply_conandata_patches to exit just after applying patches
31+
sed -i -e 's/apply_conandata_patches(self)/apply_conandata_patches(self); import sys; sys.exit(0)/g' conanfile.py
32+
# Create the package with the specified version
33+
conan create . --version=${version} --build=missing
34+
popd
35+
done
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Validate Applying Patch in Conan Center Index
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'doc/**'
7+
- '**/*.md'
8+
- 'LICENSE'
9+
- 'example/**'
10+
- '.gitignore'
11+
- 'tests/**'
12+
workflow_dispatch:
13+
pull_request:
14+
paths-ignore:
15+
- 'doc/**'
16+
- '**/*.md'
17+
- 'LICENSE'
18+
- 'example/**'
19+
- '.gitignore'
20+
- 'tests/**'
21+
22+
jobs:
23+
conan-center-index-validate:
24+
name: "Validate Patche-NG in Conan Center Index"
25+
runs-on: ubuntu-22.04
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v5
29+
30+
- name: Setup Conan client
31+
uses: conan-io/setup-conan@v1
32+
33+
- name: Setup Python NG
34+
run: pip install -e .
35+
36+
- name: Checkout conan-center-index
37+
uses: actions/checkout@v5
38+
with:
39+
repository: conan-io/conan-center-index
40+
path: conan-center-index
41+
ref: 'd8efbb6f3c51b134205f01d3f8d90bdad1a67fe6'
42+
43+
- name: Validate Python-NG patch application
44+
working-directory: conan-center-index/recipes
45+
run: bash .github/scripts/validate-cci-patch-ng.sh

0 commit comments

Comments
 (0)