conan v2 wip #101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: VCMI - dependencies | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_TAG: ${{ steps.release_tag.outputs.RELEASE_TAG }} | |
steps: | |
- name: Name release tag after today's date | |
id: release_tag | |
run: echo "RELEASE_TAG=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create draft release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.release_tag.outputs.RELEASE_TAG }} | |
draft: true | |
prerelease: true | |
build: | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - platform: mac-intel | |
# os: macos-15 | |
# before_install: macos.sh | |
# conan_profile: macos-intel | |
# conan_system_libs: bzip2 libiconv sqlite3 zlib | |
# - platform: mac-arm | |
# os: macos-15 | |
# before_install: macos.sh | |
# conan_profile: macos-arm | |
# conan_system_libs: bzip2 libiconv sqlite3 zlib | |
# - platform: ios | |
# os: macos-15 | |
# before_install: macos.sh | |
# conan_profile: ios-arm64 | |
# conan_system_libs: bzip2 libiconv sqlite3 zlib | |
# - platform: android-armeabi-v7a | |
# os: ubuntu-latest | |
# before_install: android.sh | |
# conan_profile: android-32-ndk | |
# conan_system_libs: zlib | |
# - platform: android-arm64-v8a | |
# os: ubuntu-latest | |
# conan_profile: android-64-ndk | |
# conan_system_libs: zlib | |
- platform: windows-x64 | |
os: windows-2022 | |
conan_profile: msvc-x64 | |
conan_options: -o "&:target_pre_windows10=True" | |
- platform: windows-x86 | |
os: windows-2022 | |
conan_profile: msvc-x86 | |
conan_options: -o "&:target_pre_windows10=True" | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout VCMI | |
uses: actions/checkout@v4 | |
# TODO | |
with: | |
repository: 'kambala-decapitator/vcmi' | |
ref: 'conan-v2' | |
- uses: actions/setup-java@v4 | |
if: ${{ startsWith(matrix.platform, 'android') }} | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Prepare CI | |
if: ${{ matrix.before_install }} | |
run: source '${{github.workspace}}/CI/before_install/${{matrix.before_install}}' | |
- name: Setup Conan Client | |
uses: conan-io/setup-conan@v1 | |
# CMake/Ninja version should be synced with runners | |
# https://github.com/actions/runner-images/tree/main/images | |
# using CMake from Android SDK because some runners already have CMake v4 | |
- name: Prepare platform tools | |
run: | | |
cmakeVersion=3.31.6 | |
# newPathFile=$(mktemp) | |
# echo "$ANDROID_HOME/cmake/$cmakeVersion/bin" | cat - "$GITHUB_PATH" > "$newPathFile" | |
# mv -f "$newPathFile" "$GITHUB_PATH" | |
echo " | |
[platform_tool_requires] | |
cmake/$cmakeVersion | |
ninja/1.12.1 | |
[conf] | |
tools.cmake.cmaketoolchain:generator=Ninja" >> $(conan profile path default) | |
- name: Install system libs recipes | |
if: ${{ matrix.conan_system_libs }} | |
run: | | |
systemLibsRepo='conan-system-libs' | |
git clone "https://github.com/kambala-decapitator/$systemLibsRepo.git" \ | |
--depth 1 \ | |
--no-tags \ | |
--single-branch | |
cd "$systemLibsRepo" | |
for p in ${{ matrix.conan_system_libs }} ; do | |
conan create "$p" --user system | |
done | |
- name: Checkout current | |
uses: actions/checkout@v4 | |
with: | |
path: deps | |
- name: Build recipes with our patches | |
run: | | |
echo "CONAN_HOME=$(conan config home)" >> $GITHUB_ENV | |
echo "UPLOAD_QT=1" >> $GITHUB_ENV | |
set -x | |
cciRepo='conan-center-index' | |
branchName='master' | |
recipePathQt='recipes/qt' | |
custom_patches_path="$(pwd)/deps/conan_patches" | |
#extraAndroidOptions="-o qt/*:android_sdk=$ANDROID_HOME" | |
#extraOptionsBash=${{ startsWith(matrix.platform, 'android') && '"-o qt/*:android_sdk=$ANDROID_HOME"' || '' }} | |
function slash_to_backslash { | |
slash=/ | |
echo "${1//$slash/\\}" | |
} | |
git clone "https://github.com/conan-io/$cciRepo.git" \ | |
--branch "$branchName" \ | |
--no-checkout \ | |
--depth 1 \ | |
--no-tags \ | |
--single-branch \ | |
--sparse | |
cd "$cciRepo" | |
git sparse-checkout set \ | |
recipes/minizip \ | |
recipes/flac \ | |
$recipePathQt \ | |
git checkout | |
# versions must be synced with: conan_patches/<package>/conandata.yml | |
# if no custom patches are required for a package, it should be removed from here | |
for p in minizip/1.3.1 flac/1.4.2 qt/5.15.16 ; do | |
IFS_OLD="$IFS" | |
IFS=/ | |
read package version <<<"$p" | |
IFS="$IFS_OLD" | |
if [[ $package == qt ]] ; then | |
packagePath="$recipePathQt/5.x.x" | |
else | |
packagePath="recipes/$package/all" | |
fi | |
conanCreateCommand="conan create $packagePath \ | |
--version=$version \ | |
--profile=../CI/conan/${{ matrix.conan_profile }} \ | |
--build=missing \ | |
--test-folder= \ | |
--core-conf core.sources.patch:extra_path=$custom_patches_path \ | |
" | |
# $(slash_to_backslash "$conanCreateCommand") | |
# Windows workaround for https://bugreports.qt.io/browse/QTBUG-84543 | |
PATH="/c/Strawberry/perl/bin:$PATH" $conanCreateCommand ${{ startsWith(matrix.platform, 'android') && '-o "qt/*:android_sdk=$ANDROID_HOME"' || '' }} | |
done | |
echo "UPLOAD_QT=0" >> $GITHUB_ENV | |
- name: Upload Qt | |
if: ${{ always() && env.UPLOAD_QT == 1 }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }}-qt | |
path: | | |
${{ env.CONAN_HOME }}/p/b/qt* | |
# TODO: remove when https://github.com/conan-io/conan-center-index/pull/26577 is merged | |
- name: Build LuaJIT from PR changes | |
run: | | |
cciForkRepo='cci-fork' | |
branchName='package/luajit' | |
recipePath='recipes/luajit' | |
git clone "https://github.com/kambala-decapitator/conan-center-index.git" "$cciForkRepo" \ | |
--branch "$branchName" \ | |
--no-checkout \ | |
--depth 1 \ | |
--no-tags \ | |
--single-branch \ | |
--sparse | |
cd "$cciForkRepo" | |
git sparse-checkout set "$recipePath" | |
git checkout | |
conan create "$recipePath/all" \ | |
--version=2.1.0-beta3 \ | |
--profile=../CI/conan/${{ matrix.conan_profile }} \ | |
--build=missing \ | |
--test-folder='' | |
- name: Generate conan profile | |
run: | | |
conan install . \ | |
--output-folder=conan-generated \ | |
--build=missing \ | |
--profile=CI/conan/${{ matrix.conan_profile }} \ | |
${{ matrix.conan_options }} || true | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }} | |
path: | | |
${{ env.CONAN_HOME }}/p/b/ffmp*/b/build-release | |
${{ env.CONAN_HOME }}/p/zlib*/p | |
- run: exit 1 | |
- name: Remove builds and source code | |
run: conan cache clean | |
- name: Get NDK path | |
if: ${{ startsWith(matrix.platform, 'android') }} | |
run: | | |
ndkPackage='android-ndk' | |
hexRegex='[[:xdigit:]]+' | |
ndkPackageRevision=$(conan list --format=compact "$ndkPackage/*:*" \ | |
| egrep --only-matching "$ndkPackage/\\w+#$hexRegex:$hexRegex") | |
ndkPackagePath=$(conan cache path "$ndkPackageRevision") | |
ndkPath="$ndkPackagePath/bin" | |
echo "NDK directory: $ndkPath" | |
- name: Remove build requirements' binaries | |
run: | | |
graphFile='graph.json' | |
packageListFile='pkglist.json' | |
conan graph info . \ | |
--profile=CI/conan/${{ matrix.conan_profile }} \ | |
--format=json \ | |
--build=never \ | |
--no-remote \ | |
> "$graphFile" | |
conan list \ | |
--graph "$graphFile" \ | |
--graph-context=build-only \ | |
--format=json \ | |
> "$packageListFile" | |
conan remove --list "$packageListFile" --confirm | |
- name: Create list of built packages | |
run: | | |
packageList="$(conan list --format=compact | tail -n +2)" | |
echo "CONAN_PACKAGES<<EOF | |
$packageList | |
EOF" >> $GITHUB_ENV | |
- name: Create dependencies archive | |
run: conan cache save --file dependencies-${{matrix.platform}}.tgz "*:*" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dependencies-${{ matrix.platform }} | |
compression-level: 0 | |
path: 'dependencies-${{matrix.platform}}.tgz' | |
- name: Update release with artifact and text | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.prepare.outputs.RELEASE_TAG }} | |
files: 'dependencies-${{matrix.platform}}.tgz' | |
append_body: true | |
body: | | |
<details><summary>`${{ matrix.platform }}` packages</summary> | |
${{ env.CONAN_PACKAGES }} | |
</details> | |
release: | |
needs: [prepare, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.prepare.outputs.RELEASE_TAG }} | |
draft: false |