Skip to content

conan packages

conan packages #558

Workflow file for this run

name: conan packages
on:
workflow_dispatch:
schedule:
- cron: '25 6 * * 4' # 6:25am UTC every Thursday
env:
conan-version: 1.60.0
jobs:
generate-matrix:
name: generate build matrix
runs-on: ubuntu-latest
outputs:
matrix-json: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: create build matrix
id: generate-matrix
shell: pwsh
run: |
$json = '[{"arch": "aarch64","runner": "ubuntu-20.04","os": "linux","name": "[lin-ubuntu-22.04-aarch64-Release]","distro": "ubuntu-22.04","build_type": "Release"}]'
echo "matrix=$json" >> $Env:GITHUB_OUTPUT
# - name: create build matrix
# id: generate-matrix
# shell: pwsh
# run: |
# $Jobs = @()
# @('windows', 'macos', 'linux', 'ios', 'android') | Foreach-Object {
# $Platform = $_
# $Architectures = @('x86_64', 'aarch64')
# if($Platform -Eq 'ios' -Or $Platform -Eq 'android') {
# $Architectures += 'arm'
# }
# if($Platform -Eq 'android') {
# $Architectures += 'x86'
# }
# $Architectures | ForEach-Object {
# $Architecture = $_
# $BuildTypes = @('Debug', 'Release')
# if ($Platform -Eq "macos" -Or $Platform -Eq "Android") {
# $BuildTypes += "RelWithDebInfo"
# }
# $BuildTypes | ForEach-Object {
# $BuildType = $_
# $Job = @{
# name = "[$($Platform.Substring(0, 3))-$Architecture-$BuildType]"
# arch = $Architecture
# build_type = $BuildType
# os = $Platform
# runner = switch ($Platform) {
# "windows" { "windows-2019" }
# { @("macos", "ios") -contains $_ } { "macos-latest" }
# { @("linux", "android") -contains $_ } { "ubuntu-20.04" }
# }
# }
# $Jobs += $Job
# if ($Platform -Eq "linux") {
# $Job = $Job.Clone()
# $Job["distro"] = "ubuntu-22.04"
# $Job["name"] = "[$($Platform.Substring(0, 3))-$($Job["distro"])-$Architecture-$BuildType]"
# $Jobs += $Job
# }
# }
# }
# }
# echo "matrix=$($Jobs | ConvertTo-JSON -Compress)" >> $Env:GITHUB_OUTPUT
build:
name: ${{matrix.name}}
runs-on: ${{matrix.runner}}
needs: [generate-matrix]
concurrency:
group: conan-${{ github.ref }}-${{matrix.name}}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix-json) }}
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: runner.os == 'Linux'
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
if: runner.os == 'Linux'
- name: Configure Windows runner
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --no-progress ninja
choco install --no-progress cmake
choco install --no-progress 7zip
choco install --no-progress python
choco install --no-progress vswhere
choco install --no-progress nasm
echo "${Env:ProgramFiles}\NASM" | Out-File -FilePath $Env:GITHUB_PATH -Encoding UTF8 -Append
Invoke-WebRequest -Uri 'https://www.tortall.net/projects/yasm/releases/yasm-1.2.0-win64.exe' -OutFile 'yasm.exe'
Move-Item .\yasm.exe "${Env:ProgramFiles}\NASM\yasm.exe"
pip install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
echo $PSVersionTable
echo "CONAN_USER_HOME=C:/tmp" >> $Env:GITHUB_ENV
- name: Configure macOS runner
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Configure macOS runner
if: runner.os == 'macOS'
env:
CMAKE_OSX_DEPLOYMENT_TARGET: "10.12"
run: |
brew install ninja
brew install cmake
brew install python
brew install nasm yasm
pip3 install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
sudo rm -rf /Library/Developer/CommandLineTools
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
- name: Configure Linux runner
if: runner.os == 'Linux'
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get install ninja-build cmake xz-utils nasm yasm python3 python3-pip python3-wget python3-setuptools
pip3 install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
- name: Install clang+llvm
if: runner.os == 'Linux'
run: |
CLANG_LLVM_OS="ubuntu-$(lsb_release -rs)"
CLANG_LLVM_BASE_URL="https://github.com/awakecoding/llvm-prebuilt/releases/download/v2021.2.4"
CLANG_LLVM_NAME="clang+llvm-12.0.1-x86_64-${CLANG_LLVM_OS}"
wget -q "${CLANG_LLVM_BASE_URL}/${CLANG_LLVM_NAME}.tar.xz"
tar -xf "${CLANG_LLVM_NAME}.tar.xz" -C /tmp
sudo mv "/tmp/${CLANG_LLVM_NAME}" /opt/llvm
echo "PATH=$PATH:/opt/llvm/bin" >> $GITHUB_ENV
- name: Configure Android NDK
if: matrix.os == 'android'
run: |
## Pin the cmake version for now, libpng builds are failing on Android x86-64
## Probably related to cmake 3.25 setting LINUX
## https://gitlab.kitware.com/cmake/cmake/-/issues/24196
## https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7963
pip3 install cmake==3.24.2
cmake --version
- name: Configure conan environment
shell: pwsh
run: |
conan config init
conan config install ./settings
conan remote disable conancenter
$ConanManifestTime = $(git log -1 --pretty=format:%ct)
echo "CONAN_MANIFEST_TIME=$ConanManifestTime" >> $Env:GITHUB_ENV
- name: Build conan packages
shell: pwsh
run: |
if ("${{ matrix.distro }}") {
./build.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }} -Distribution ${{ matrix.distro }}
} else {
./build.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }}
}
- name: Package conan cache
id: package-conan-cache
shell: pwsh
run: |
$PACKAGE_NAME="conan-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.build_type }}"
if ("${{ matrix.distro }}") {
$PACKAGE_NAME += "_${{ matrix.distro }}"
}
conan remove --locks
$CONAN_DATA = Join-Path $Env:CONAN_USER_HOME ".conan" "data"
$RemoveList = Get-ChildItem "${CONAN_DATA}" -Include @("build","source") -Directory -Depth 4 -Recurse -Name
$RemoveList | ForEach-Object { Remove-Item -Path "$CONAN_DATA/$_" -Recurse -Force }
$ConanManifests = Get-ChildItem $CONAN_DATA -Recurse -Include "conanmanifest.txt"
$ConanManifestTime = $Env:CONAN_MANIFEST_TIME
foreach ($ManifestFile in $ConanManifests) {
$Manifest = Get-Content $ManifestFile
$Manifest[0] = $ConanManifestTime
$Manifest | Out-File $ManifestFile
}
tar -czf "${PACKAGE_NAME}.tar.gz" -C "$Env:CONAN_USER_HOME" ".conan"
echo "package_name=$PACKAGE_NAME" >> $Env:GITHUB_OUTPUT
- name: Upload conan cache
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package-conan-cache.outputs.package_name }}
path: ${{ steps.package-conan-cache.outputs.package_name }}.tar.gz
publish:
needs: build
if: github.event_name != 'schedule'
uses: ./.github/workflows/conan-publish.yml
secrets: inherit