Skip to content

Commit 79a1f26

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

File tree

3 files changed

+193
-88
lines changed

3 files changed

+193
-88
lines changed

.github/workflows/rebuildDependencies.yml

Lines changed: 186 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -10,139 +10,237 @@ on:
1010
jobs:
1111
build:
1212
strategy:
13-
fail-fast: false
13+
fail-fast: true
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: Prepare CI
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+
${{ matrix.before_install && 'ci/${{ matrix.before_install }}' }}
62+
63+
- name: Obtain path to the Windows-aware Perl
64+
if: ${{ startsWith(matrix.platform, 'windows') }}
65+
run: |
66+
windowsPerl=$(which -a perl | fgrep Strawberry)
67+
echo "WINDOWS_PERL_DIR=$(dirname "$winPerl")" >> "$GITHUB_ENV"
6368
6469
- uses: actions/setup-java@v4
6570
if: ${{ startsWith(matrix.platform, 'android') }}
6671
with:
6772
distribution: 'temurin'
68-
java-version: '11'
73+
java-version: '17'
6974

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') }}
75+
- name: Setup Conan Client
8576
run: |
86-
mv ~/.conan/data/libiconv ~/
87-
rm -rf ~/.conan/data/*/*/_/_/package
88-
mv ~/libiconv ~/.conan/data
77+
pipx install conan
78+
conan profile detect
8979
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
80+
# CMake/Ninja version should be synced with runners
81+
# https://github.com/actions/runner-images/tree/main/images
82+
- name: Prepare platform tools
9383
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' }}
84+
echo "
85+
[platform_tool_requires]
86+
cmake/3.31.6
87+
ninja/1.13.1
88+
89+
[conf]
90+
tools.cmake.cmaketoolchain:generator=Ninja" >> $(conan profile path default)
91+
92+
- name: Install system libs recipes
93+
if: ${{ matrix.conan_system_libs }}
94+
run: |
95+
systemLibsRepo='conan-system-libs'
96+
git clone "https://github.com/kambala-decapitator/$systemLibsRepo.git" \
97+
--depth 1 \
98+
--no-tags \
99+
--single-branch
100+
cd "$systemLibsRepo"
101+
for p in ${{ matrix.conan_system_libs }} ; do
102+
conan create "$p" --user system
103+
done
104+
105+
- name: Build recipes with our patches
104106
run: |
105-
rm -rf ~/.conan/data/sqlite3
107+
cciRepo='conan-center-index'
108+
branchName='master'
109+
recipePathQt='recipes/qt'
110+
111+
git clone "https://github.com/conan-io/$cciRepo.git" \
112+
--branch "$branchName" \
113+
--no-checkout \
114+
--depth 1 \
115+
--no-tags \
116+
--single-branch \
117+
--sparse
118+
cd "$cciRepo"
119+
git sparse-checkout set \
120+
recipes/minizip \
121+
recipes/flac \
122+
$recipePathQt \
123+
124+
git checkout
125+
126+
# versions must be synced with: conan_patches/<package>/conandata.yml
127+
# if no custom patches are required for a package, it should be removed from here
128+
for p in minizip/1.3.1 flac/1.4.2 qt/5.15.16 ; do
129+
IFS_OLD="$IFS"
130+
IFS=/
131+
read package version <<<"$p"
132+
IFS="$IFS_OLD"
133+
134+
if [[ $package == qt ]] ; then
135+
packagePath="$recipePathQt/5.x.x"
136+
else
137+
packagePath="recipes/$package/all"
138+
fi
106139
107-
- name: Install Conan
108-
run: pipx install 'conan<2.0'
140+
# Windows workaround for https://bugreports.qt.io/browse/QTBUG-84543
141+
PATH="$WINDOWS_PERL_DIR:$PATH" conan create $packagePath \
142+
--version=$version \
143+
--profile=../conan_profiles/${{ matrix.conan_profile }} \
144+
--build=missing \
145+
--test-folder= \
146+
--core-conf core.sources.patch:extra_path=$CUSTOM_PATCHES_PATH \
147+
${{ startsWith(matrix.platform, 'android') && '-o "qt/*:android_sdk=$ANDROID_HOME"' || '' }}
148+
done
149+
150+
# TODO: remove LuaJIT when https://github.com/conan-io/conan-center-index/pull/26577 is merged
151+
- name: Build LuaJIT from PR changes
152+
run: |
153+
cciForkRepo='cci-fork'
154+
branchName='vcmi'
155+
recipePathQt='recipes/qt'
156+
157+
git clone "https://github.com/kambala-decapitator/conan-center-index.git" "$cciForkRepo" \
158+
--branch "$branchName" \
159+
--no-checkout \
160+
--depth 1 \
161+
--no-tags \
162+
--single-branch \
163+
--sparse
164+
cd "$cciForkRepo"
165+
git sparse-checkout set \
166+
recipes/luajit \
167+
168+
git checkout
169+
170+
for p in luajit/2.1.0-beta3 ; do
171+
IFS_OLD="$IFS"
172+
IFS=/
173+
read package version <<<"$p"
174+
IFS="$IFS_OLD"
175+
176+
conan create "recipes/$package/all" \
177+
--version=$version \
178+
--profile=../conan_profiles/${{ matrix.conan_profile }} \
179+
--build=missing \
180+
--test-folder= \
181+
--core-conf core.sources.patch:extra_path=$CUSTOM_PATCHES_PATH
182+
done
109183
110184
- name: Generate conan profile
111185
run: |
112-
conan profile new default --detect
113186
conan install . \
114-
--install-folder=conan-generated \
115-
--no-imports \
187+
--output-folder=conan-generated \
116188
--build=missing \
117-
--profile:build=default \
118-
--profile:host=CI/conan/${{ matrix.conan_profile }} \
189+
--profile=conan_profiles/${{ matrix.conan_profile }} \
119190
${{ matrix.conan_options }}
120-
env:
121-
GENERATE_ONLY_BUILT_CONFIG: 1
122191
123192
- name: Remove builds and source code
124-
run: "conan remove --builds --src --force '*'"
125-
126-
- name: Remove build requirements
193+
run: conan cache clean
194+
195+
- name: Get NDK path
196+
if: ${{ startsWith(matrix.platform, 'android') }}
127197
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
198+
ndkPackage='android-ndk'
199+
hexRegex='[[:xdigit:]]+'
200+
201+
ndkPackageRevision=$(conan list --format=compact "$ndkPackage/*:*" \
202+
| egrep --only-matching "$ndkPackage/\\w+#$hexRegex:$hexRegex")
203+
ndkPackagePath=$(conan cache path "$ndkPackageRevision")
204+
ndkPath="$ndkPackagePath/bin"
205+
echo "NDK directory: $ndkPath"
206+
207+
- name: Remove build requirements' binaries
208+
run: |
209+
graphFile='graph.json'
210+
packageListFile='pkglist.json'
211+
212+
conan graph info . \
213+
--profile=conan_profiles/${{ matrix.conan_profile }} \
214+
--format=json \
215+
--build=never \
216+
--no-remote \
217+
> "$graphFile"
218+
conan list \
219+
--graph "$graphFile" \
220+
--graph-context=build-only \
221+
--format=json \
222+
> "$packageListFile"
223+
conan remove --list "$packageListFile" --confirm
224+
225+
- name: Create list of built packages
226+
run: |
227+
packageList="$(conan list --format=compact | tail -n +2)"
228+
echo "$packageList" > "$DEPS_LIST_FILE"
229+
echo "CONAN_PACKAGES<<EOF
230+
$packageList
231+
EOF" >> "$GITHUB_ENV"
139232
140233
- name: Create dependencies archive
141-
run: "tar --create --xz --file dependencies-${{matrix.platform}}.txz -C ~/.conan data"
234+
run: conan cache save --file "$DEPS_FILE" "*:*"
142235

143-
- name: Upload artifacts
236+
- name: Upload binaries list
237+
uses: actions/upload-artifact@v4
238+
with:
239+
name: list of dependencies-${{ matrix.platform }}
240+
path: ${{ env.DEPS_LIST_FILE }}
241+
- name: Upload binaries
144242
uses: actions/upload-artifact@v4
145243
with:
146244
name: dependencies-${{ matrix.platform }}
147245
compression-level: 0
148-
path: 'dependencies-${{matrix.platform}}.txz'
246+
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)