conan packages #747
Workflow file for this run
This file contains 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: conan packages | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '25 6 * * 4' # 6:25am UTC every Thursday | |
env: | |
conan-version: 1.66.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: | | |
$Jobs = @() | |
@('windows', 'macos', 'linux', 'ios', 'android') | Foreach-Object { | |
$Platform = $_ | |
$Architectures = @('x86_64', 'aarch64') | |
if($Platform -Eq 'android') { | |
$Architectures += 'arm' | |
$Architectures += 'x86' | |
} | |
$Architectures | ForEach-Object { | |
$Architecture = $_ | |
$BuildTypes = @('Debug', 'Release') | |
if ($Platform -Eq "windows" -Or $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-2022" } | |
{ @("macos", "ios") -contains $_ } { "macos-latest" } | |
{ @("linux", "android") -contains $_ } { "ubuntu-22.04" } | |
} | |
} | |
if ($Platform -Eq "macos" -And $Architecture -Eq "x86_64") { | |
$Job.runner = "macos-13" | |
} | |
$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@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:qemu-v7.0.0-28 # https://github.com/docker/setup-qemu-action/issues/198 | |
if: runner.os == 'Linux' | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
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@v5 | |
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 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-20.04" | |
CLANG_LLVM_BASE_URL="https://github.com/awakecoding/llvm-prebuilt/releases/download/v2023.3.0" | |
CLANG_LLVM_NAME="clang+llvm-14.0.6-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@v4 | |
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 | |
notify: | |
name: Notify failure | |
runs-on: ubuntu-latest | |
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }} | |
needs: | |
- generate-matrix | |
- build | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
steps: | |
- name: Send slack notification | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>" | |
} | |
} | |
] | |
} |