Skip to content

Commit 3388739

Browse files
[CI] adapt to Conan v2
1 parent 6ee3a62 commit 3388739

File tree

3 files changed

+195
-87
lines changed

3 files changed

+195
-87
lines changed

.github/workflows/rebuildDependencies.yml

Lines changed: 188 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -14,135 +14,236 @@ jobs:
1414
matrix:
1515
include:
1616
- platform: mac-intel
17-
os: macos-13
17+
os: macos-14
1818
before_install: macos.sh
1919
conan_profile: macos-intel
20-
conan_prebuilts: dependencies-mac-intel
21-
conan_options: --options with_apple_system_libs=True
20+
conan_system_libs: bzip2 libiconv sqlite3 zlib
2221
- platform: mac-arm
23-
os: macos-13
22+
os: macos-14
2423
before_install: macos.sh
2524
conan_profile: macos-arm
26-
conan_prebuilts: dependencies-mac-arm
27-
conan_options: --options with_apple_system_libs=True
25+
conan_system_libs: bzip2 libiconv sqlite3 zlib
2826
- platform: ios
29-
os: macos-13
27+
os: macos-14
3028
before_install: macos.sh
3129
conan_profile: ios-arm64
32-
conan_prebuilts: dependencies-ios
33-
conan_options: --options with_apple_system_libs=True
34-
- platform: mingw-x86-64
35-
os: ubuntu-24.04
36-
before_install: mingw.sh
37-
conan_profile: mingw64-linux.jinja
38-
conan_prebuilts: dependencies-mingw-x86-64
39-
- platform: mingw-x86
40-
os: ubuntu-24.04
41-
before_install: mingw.sh
42-
conan_profile: mingw32-linux.jinja
43-
conan_prebuilts: dependencies-mingw-x86
30+
conan_system_libs: bzip2 libiconv sqlite3 zlib
4431
- platform: android-armeabi-v7a
45-
os: ubuntu-24.04
32+
os: ubuntu-latest
33+
before_install: android-32.sh
4634
conan_profile: android-32-ndk
47-
conan_prebuilts: dependencies-android-armeabi-v7a
35+
conan_system_libs: zlib
4836
- platform: android-arm64-v8a
49-
os: ubuntu-24.04
37+
os: ubuntu-latest
5038
conan_profile: android-64-ndk
51-
conan_prebuilts: dependencies-android-arm64-v8a
39+
conan_system_libs: zlib
40+
- platform: windows-x64
41+
os: windows-latest
42+
conan_profile: msvc-x64
43+
conan_options: -o "&:target_pre_windows10=True"
44+
- platform: windows-x86
45+
os: windows-latest
46+
conan_profile: msvc-x86
47+
conan_options: -o "&:target_pre_windows10=True"
5248
runs-on: ${{ matrix.os }}
5349
defaults:
5450
run:
5551
shell: bash
56-
5752
steps:
58-
- name: Checkout repository
53+
- name: Checkout current
5954
uses: actions/checkout@v4
60-
with:
61-
repository: 'vcmi/vcmi'
62-
ref: 'update_prebuilts'
55+
56+
- name: Define common variables
57+
run: |
58+
echo CUSTOM_PATCHES_PATH="$(pwd)/conan_patches" >> "$GITHUB_ENV"
59+
echo DEPS_FILE="dependencies-${{ matrix.platform }}.tgz" >> "$GITHUB_ENV"
60+
echo DEPS_LIST_FILE="dependencies-${{ matrix.platform }}.txt" >> "$GITHUB_ENV"
61+
62+
- name: Prepare CI
63+
if: ${{ matrix.before_install }}
64+
run: ci/${{ matrix.before_install }}
65+
66+
- name: Obtain path to the Windows-aware Perl
67+
if: ${{ startsWith(matrix.platform, 'windows') }}
68+
run: |
69+
windowsPerl=$(which -a perl | fgrep Strawberry)
70+
echo "WINDOWS_PERL_DIR=$(dirname "$winPerl")" >> "$GITHUB_ENV"
6371
6472
- uses: actions/setup-java@v4
6573
if: ${{ startsWith(matrix.platform, 'android') }}
6674
with:
6775
distribution: 'temurin'
68-
java-version: '11'
76+
java-version: '17'
6977

70-
- name: Prepare CI
71-
if: "${{ matrix.before_install != '' }}"
72-
run: source '${{github.workspace}}/CI/before_install/${{matrix.before_install}}'
73-
74-
- name: Install Conan Dependencies
75-
if: "${{ matrix.conan_prebuilts != '' }}"
76-
run: source '${{github.workspace}}/CI/install_conan_dependencies.sh' '${{matrix.conan_prebuilts}}'
77-
78-
- name: Remove old binary packages (non-android)
79-
if: ${{ !startsWith(matrix.platform, 'android') }}
80-
run: rm -rf ~/.conan/data/*/*/_/_/package
81-
82-
# TODO: fix libiconv - fails to build on android (both macos and linux host)
83-
- name: Remove old binary packages (android)
84-
if: ${{ startsWith(matrix.platform, 'android') }}
78+
- name: Setup Conan Client
79+
run: |
80+
pipx install conan
81+
conan profile detect
82+
83+
# CMake/Ninja version should be synced with runners
84+
# https://github.com/actions/runner-images/tree/main/images
85+
- name: Prepare platform tools
86+
run: |
87+
echo "
88+
[platform_tool_requires]
89+
cmake/3.31.6
90+
ninja/1.13.1
91+
92+
[conf]
93+
tools.cmake.cmaketoolchain:generator=Ninja" >> $(conan profile path default)
94+
95+
- name: Install system libs recipes
96+
if: ${{ matrix.conan_system_libs }}
8597
run: |
86-
mv ~/.conan/data/libiconv ~/
87-
rm -rf ~/.conan/data/*/*/_/_/package
88-
mv ~/libiconv ~/.conan/data
98+
systemLibsRepo='conan-system-libs'
99+
git clone "https://github.com/kambala-decapitator/$systemLibsRepo.git" \
100+
--depth 1 \
101+
--no-tags \
102+
--single-branch
103+
cd "$systemLibsRepo"
104+
for p in ${{ matrix.conan_system_libs }} ; do
105+
conan create "$p" --user system
106+
done
89107
90-
# Completely remove packages that were confirmed to be rebuildable using upstream recipe/sources
91-
# TODO: generate entire package from scratch instead of such cleanup
92-
- name: Remove old recipes
108+
- name: Build recipes with our patches
93109
run: |
94-
rm -rf ~/.conan/data/boost
95-
rm -rf ~/.conan/data/ffmpeg
96-
rm -rf ~/.conan/data/xz_utils
97-
rm -rf ~/.conan/data/sdl_mixer
98-
rm -rf ~/.conan/data/sdl_image
99-
rm -rf ~/.conan/data/sdl_ttf
100-
rm -rf ~/.conan/data/sdl
101-
102-
- name: Remove old recipes (non-apple)
103-
if: ${{ matrix.platform != 'ios' && matrix.platform != 'mac-intel' && matrix.platform != 'mac-arm' }}
110+
cciRepo='conan-center-index'
111+
branchName='master'
112+
recipePathQt='recipes/qt'
113+
114+
git clone "https://github.com/conan-io/$cciRepo.git" \
115+
--branch "$branchName" \
116+
--no-checkout \
117+
--depth 1 \
118+
--no-tags \
119+
--single-branch \
120+
--sparse
121+
cd "$cciRepo"
122+
git sparse-checkout set \
123+
recipes/minizip \
124+
recipes/flac \
125+
$recipePathQt \
126+
127+
git checkout
128+
129+
# versions must be synced with: conan_patches/<package>/conandata.yml
130+
# if no custom patches are required for a package, it should be removed from here
131+
for p in minizip/1.3.1 flac/1.4.2 qt/5.15.16 ; do
132+
IFS_OLD="$IFS"
133+
IFS=/
134+
read package version <<<"$p"
135+
IFS="$IFS_OLD"
136+
137+
if [[ $package == qt ]] ; then
138+
packagePath="$recipePathQt/5.x.x"
139+
else
140+
packagePath="recipes/$package/all"
141+
fi
142+
143+
# Windows workaround for https://bugreports.qt.io/browse/QTBUG-84543
144+
PATH="$WINDOWS_PERL_DIR:$PATH" conan create $packagePath \
145+
--version=$version \
146+
--profile=../conan_profiles/${{ matrix.conan_profile }} \
147+
--build=missing \
148+
--test-folder= \
149+
--core-conf core.sources.patch:extra_path=$CUSTOM_PATCHES_PATH \
150+
${{ startsWith(matrix.platform, 'android') && '-o "qt/*:android_sdk=$ANDROID_HOME"' || '' }}
151+
done
152+
153+
# TODO: remove LuaJIT when https://github.com/conan-io/conan-center-index/pull/26577 is merged
154+
- name: Build LuaJIT from PR changes
104155
run: |
105-
rm -rf ~/.conan/data/sqlite3
156+
cciForkRepo='cci-fork'
157+
branchName='vcmi'
158+
recipePathQt='recipes/qt'
159+
160+
git clone "https://github.com/kambala-decapitator/conan-center-index.git" "$cciForkRepo" \
161+
--branch "$branchName" \
162+
--no-checkout \
163+
--depth 1 \
164+
--no-tags \
165+
--single-branch \
166+
--sparse
167+
cd "$cciForkRepo"
168+
git sparse-checkout set \
169+
recipes/luajit \
106170
107-
- name: Install Conan
108-
run: pipx install 'conan<2.0'
171+
git checkout
172+
173+
for p in luajit/2.1.0-beta3 ; do
174+
IFS_OLD="$IFS"
175+
IFS=/
176+
read package version <<<"$p"
177+
IFS="$IFS_OLD"
178+
179+
conan create "recipes/$package/all" \
180+
--version=$version \
181+
--profile=../conan_profiles/${{ matrix.conan_profile }} \
182+
--build=missing \
183+
--test-folder= \
184+
--core-conf core.sources.patch:extra_path=$CUSTOM_PATCHES_PATH
185+
done
109186
110187
- name: Generate conan profile
111188
run: |
112-
conan profile new default --detect
113189
conan install . \
114-
--install-folder=conan-generated \
115-
--no-imports \
190+
--output-folder=conan-generated \
116191
--build=missing \
117-
--profile:build=default \
118-
--profile:host=CI/conan/${{ matrix.conan_profile }} \
192+
--profile=conan_profiles/${{ matrix.conan_profile }} \
119193
${{ matrix.conan_options }}
120-
env:
121-
GENERATE_ONLY_BUILT_CONFIG: 1
122194
123195
- name: Remove builds and source code
124-
run: "conan remove --builds --src --force '*'"
125-
126-
- name: Remove build requirements
196+
run: conan cache clean
197+
198+
- name: Get NDK path
199+
if: ${{ startsWith(matrix.platform, 'android') }}
127200
run: |
128-
rm -rf ~/.conan/data/android-ndk
129-
rm -rf ~/.conan/data/autoconf
130-
rm -rf ~/.conan/data/automake
131-
rm -rf ~/.conan/data/b2
132-
rm -rf ~/.conan/data/cmake
133-
rm -rf ~/.conan/data/gnu-config
134-
rm -rf ~/.conan/data/libtool
135-
rm -rf ~/.conan/data/m4
136-
rm -rf ~/.conan/data/nasm
137-
rm -rf ~/.conan/data/pkgconf
138-
rm -rf ~/.conan/data/yasm
201+
ndkPackage='android-ndk'
202+
hexRegex='[[:xdigit:]]+'
203+
204+
ndkPackageRevision=$(conan list --format=compact "$ndkPackage/*:*" \
205+
| egrep --only-matching "$ndkPackage/\\w+#$hexRegex:$hexRegex")
206+
ndkPackagePath=$(conan cache path "$ndkPackageRevision")
207+
ndkPath="$ndkPackagePath/bin"
208+
echo "NDK directory: $ndkPath"
209+
210+
- name: Remove build requirements' binaries
211+
run: |
212+
graphFile='graph.json'
213+
packageListFile='pkglist.json'
214+
215+
conan graph info . \
216+
--profile=conan_profiles/${{ matrix.conan_profile }} \
217+
--format=json \
218+
--build=never \
219+
--no-remote \
220+
> "$graphFile"
221+
conan list \
222+
--graph "$graphFile" \
223+
--graph-context=build-only \
224+
--format=json \
225+
> "$packageListFile"
226+
conan remove --list "$packageListFile" --confirm
227+
228+
- name: Create list of built packages
229+
run: |
230+
packageList="$(conan list --format=compact | tail -n +2)"
231+
echo "$packageList" > "$DEPS_LIST_FILE"
232+
echo "CONAN_PACKAGES<<EOF
233+
$packageList
234+
EOF" >> "$GITHUB_ENV"
139235
140236
- name: Create dependencies archive
141-
run: "tar --create --xz --file dependencies-${{matrix.platform}}.txz -C ~/.conan data"
237+
run: conan cache save --file "$DEPS_FILE" "*:*"
142238

143-
- name: Upload artifacts
239+
- name: Upload binaries list
240+
uses: actions/upload-artifact@v4
241+
with:
242+
name: list of dependencies-${{ matrix.platform }}
243+
path: ${{ env.DEPS_LIST_FILE }}
244+
- name: Upload binaries
144245
uses: actions/upload-artifact@v4
145246
with:
146247
name: dependencies-${{ matrix.platform }}
147248
compression-level: 0
148-
path: 'dependencies-${{matrix.platform}}.txz'
249+
path: ${{ env.DEPS_FILE }}

ci/android-32.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
# for LuaJIT
4+
sudo apt install libc6-dev-i386

ci/macos.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
echo DEVELOPER_DIR=/Applications/Xcode_16.2.app >> $GITHUB_ENV

0 commit comments

Comments
 (0)