build #136
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: build | |
on: | |
push: | |
paths: | |
- 'recipes/**' | |
workflow_dispatch: | |
inputs: | |
package_name: | |
description: Package name | |
type: choice | |
options: | |
- all | |
- odrcore | |
- pdf2htmlex | |
- fontforge | |
- poppler | |
- poppler-data | |
- cairo | |
- openlibm | |
- fontconfig | |
- glib | |
package_version: | |
description: Package version. Specify 'newest' or leave empty to request the newest version. Specify 'all' to request all versions. | |
required: false | |
upload_to_artifactory: | |
description: Upload built packages to artifactory | |
type: boolean | |
default: false | |
build_dependants: | |
description: Parse conan dependency tree and build not just the requested package, but also all dependants of it | |
type: boolean | |
default: true | |
build_from_source: | |
description: Build all dependencies from source (conan install --build=* instead of --build=missing) | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
CCACHE_MAXSIZE: 500M | |
CCACHE_KEY_SUFFIX: r1 | |
jobs: | |
generate-matrices: | |
runs-on: ubuntu-22.04 | |
outputs: | |
packages-with-dependents: ${{ steps.list-packages-with-dependents.outputs.packages }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch whole git history. | |
# Required to parse modified packages | |
fetch-depth: 0 | |
- name: setup python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: install python dependencies | |
run: pip install --upgrade pip conan | |
- name: conan config | |
run: conan config install .github/config/ubuntu-22.04/conan | |
- name: Conan export all packages | |
run: python scripts/conan_export_all_packages.py | |
# Generate dependency graphs for all disjoint packages | |
# Dependency graphs for android-21 and android-23 profiles are not identical. | |
# android-21 has an extra openlibm dependency. Android ABI does not matter for dependency graph, as long as it's still Android. | |
# Generating graphs for both 21 and 23 would be more self-explanatory, but conan graph generation takes a few seconds. | |
- name: Generate odrcore dependency tree | |
id: odrcore-dependency-tree | |
if: ${{ github.event.inputs.build_dependants != 'false' }} | |
shell: bash # bash shell needed to pipefail on error | |
run: | | |
conan graph info recipes/odrcore/all/conanfile.py --version=4.0.0 --profile:host=android-21-armv8 --format=json | tee odrcore-dependency-tree.json | |
echo "graph_file=odrcore-dependency-tree.json" >> $GITHUB_OUTPUT | |
# Once odrcore depends on pdf2htmlex, pdf2htmlEX-dependency-tree.json generation and usage can be removed | |
- name: Generate pdf2htmlex dependency tree | |
id: pdf2htmlex-dependency-tree | |
if: ${{ github.event.inputs.build_dependants != 'false' }} | |
shell: bash # bash shell needed to pipefail on error | |
run: | | |
conan graph info recipes/pdf2htmlex/all/conanfile.py --version=0.18.8.rc1-20240619-git --profile:host=android-21-armv8 --format=json | tee pdf2htmlEX-dependency-tree.json | |
echo "graph_file=pdf2htmlEX-dependency-tree.json" >> $GITHUB_OUTPUT | |
- name: Get requested packages and dependants from commits and workflow_dispatch inputs | |
id: list-packages-with-dependents | |
run: python scripts/list_package_versions.py --dependency-graph ${{ steps.odrcore-dependency-tree.outputs.graph_file }} ${{ steps.pdf2htmlex-dependency-tree.outputs.graph_file }} | |
env: | |
GITHUB_EVENT: ${{ toJson(github.event) }} | |
build: | |
runs-on: ${{ matrix.config.build_machine }} | |
if: ${{ needs.generate-matrices.outputs.packages-with-dependents != '[]' }} | |
name: ${{ matrix.config.host_profile }} ${{ matrix.package.package_reference }} | |
needs: | |
- generate-matrices | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{ fromJson(needs.generate-matrices.outputs.packages-with-dependents) }} | |
config: | |
- { build_machine: ubuntu-22.04, host_profile: ubuntu } | |
- { build_machine: ubuntu-22.04, host_profile: android-23-armv8, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-23-armv7, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-23-x86, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-23-x86_64, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-21-armv8, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-21-armv7, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-21-x86, ndk_version: 26.3.11579264 } | |
- { build_machine: ubuntu-22.04, host_profile: android-21-x86_64, ndk_version: 26.3.11579264 } | |
# Known not working build configurations | |
# Would be cool to actually solve odrcore/1.0.0 for Android | |
exclude: | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-23-armv8, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-23-armv7, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-23-x86, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-23-x86_64, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-21-armv8, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-21-armv7, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-21-x86, ndk_version: 26.3.11579264 } | |
- package: { "package_reference": "odrcore/1.0.0", "package": "odrcore", "version": "1.0.0", "conanfile": "recipes/odrcore/all/conanfile.py", "test_conanfile": "recipes/odrcore/all/test_package/conanfile.py" } | |
config: { build_machine: ubuntu-22.04, host_profile: android-21-x86_64, ndk_version: 26.3.11579264 } | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: ubuntu install ccache | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install ccache | |
ccache -V | |
- name: macos install ccache | |
if: runner.os == 'macOS' | |
run: | | |
brew install ccache | |
ccache -V | |
- name: setup python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: install python dependencies and setuptools (required to build GLib) | |
run: pip install --upgrade pip conan setuptools | |
- name: install NDK | |
if: startsWith(matrix.config.host_profile, 'android') | |
run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ matrix.config.ndk_version }}" | |
- name: conan remote | |
run: conan remote add --index 0 odr https://artifactory.opendocument.app/artifactory/api/conan/conan | |
- name: conan config | |
run: conan config install .github/config/${{ matrix.config.build_machine }}/conan | |
# Export all recipes to local conan cache, to make sure all changes in all dependencies are picked up | |
- name: Conan export all packages | |
run: python scripts/conan_export_all_packages.py | |
- name: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.ccache | |
/Users/runner/Library/Caches/ccache | |
key: ${{ matrix.config.build_machine }}-${{ matrix.config.host_profile }}-${{ env.CCACHE_KEY_SUFFIX }} | |
restore-keys: | | |
${{ matrix.config.build_machine }}-${{ matrix.config.host_profile }}- | |
- name: Parse build from source option | |
id: build_from_source | |
run: | | |
if [ ${{ github.event.inputs.build_from_source }} == "true" ]; then | |
echo argument=--build=* >> $GITHUB_OUTPUT | |
else | |
echo argument=--build=missing >> $GITHUB_OUTPUT | |
fi | |
- name: conan install | |
run: conan install ${{ matrix.package.conanfile }} --version ${{ matrix.package.version }} ${{ steps.build_from_source.outputs.argument }} --profile:host ${{ matrix.config.host_profile }} --profile:build ubuntu | |
- name: conan source | |
run: conan source ${{ matrix.package.conanfile }} --version ${{ matrix.package.version }} | |
- name: conan build | |
run: conan build ${{ matrix.package.conanfile }} --version ${{ matrix.package.version }} --profile:host ${{ matrix.config.host_profile }} --profile:build ubuntu | |
- name: conan export | |
run: conan export ${{ matrix.package.conanfile }} --version ${{ matrix.package.version }} | |
- name: conan export-pkg | |
run: conan export-pkg ${{ matrix.package.conanfile }} --version ${{ matrix.package.version }} --profile:host ${{ matrix.config.host_profile }} --profile:build ubuntu | |
- name: conan test | |
run: conan test ${{ matrix.package.test_conanfile }} ${{ matrix.package.package_reference }} --build missing --profile:host ${{ matrix.config.host_profile }} --profile:build ubuntu | |
- name: conan login | |
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' && github.event.inputs.upload_to_artifactory == 'true' | |
run: conan remote login odr admin --password ${{ secrets.ARTIFACTORY }} | |
- name: conan upload | |
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' && github.event.inputs.upload_to_artifactory == 'true' | |
run: conan upload "*" --check --confirm --remote odr | |
- run: ccache --show-stats |