Skip to content

Commit

Permalink
Merge pull request #53 from Ultimaker/CURA-11622_conan_v2
Browse files Browse the repository at this point in the history
CURA-11622 Migrate to conan V2
  • Loading branch information
wawanbreton authored Dec 4, 2024
2 parents 94ad4be + 2895969 commit 4a8f633
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 315 deletions.
176 changes: 23 additions & 153 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
@@ -1,158 +1,28 @@
---
name: conan-package

# Exports the recipe, sources and binaries for Mac, Windows and Linux and upload these to the server such that these can
# be used downstream.
#
# It should run on pushes against main or CURA-* branches, but it will only create the binaries for main and release branches

on:
workflow_dispatch:
inputs:
# FIXME: Not yet implemented
conan_id:
required: false
type: string
description: 'The full conan package ID, e.g. "libnest2d/1.2.3@ultimaker/stable"'
create_latest_alias:
required: true
default: false
type: boolean
description: 'Create latest alias'
create_binaries_windows:
required: true
default: false
type: boolean
description: 'create binaries Windows'
create_binaries_linux:
required: true
default: false
type: boolean
description: 'create binaries Linux'
create_binaries_macos:
required: true
default: false
type: boolean
description: 'create binaries Macos'

push:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'cmake/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/conan-package.yml'
- '.github/workflows/requirements*'
branches:
- main
- master
- 'CURA-*'
- '[0-9].[0-9]'
- '[0-9].[0-9][0-9]'
tags:
- '[0-9].[0-9].[0-9]*'
- '[0-9].[0-9][0-9].[0-9]*'
push:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/conan-package.yml'
branches:
- main
- master
- 'CURA-*'
- 'PP-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'
tags:
- '[0-9].[0-9].[0-9]*'
- '[0-9].[0-9][0-9].[0-9]*'

jobs:
conan-recipe-version:
uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
with:
project_name: savitar

conan-package-export:
needs: [ conan-recipe-version ]
uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
runs_on: 'ubuntu-20.04'
python_version: '3.10.x'
conan_logging_level: 'info'
secrets: inherit

conan-package-create-windows:
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true' )) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_windows) }}
needs: [ conan-recipe-version, conan-package-export ]

uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main
with:
project_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
build_id: 4
runs_on: 'windows-2022'
python_version: '3.10.x'
conan_config_branch: ''
conan_logging_level: 'info'
secrets: inherit

conan-package-create-macos:
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_macos) }}
needs: [ conan-recipe-version, conan-package-export ]

uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main
with:
project_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
build_id: 3
runs_on: 'macos-11'
python_version: '3.10.x'
conan_logging_level: 'info'
secrets: inherit

conan-package-create-linux-modern:
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux) }}
needs: [ conan-recipe-version, conan-package-export ]

uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
project_name: ${{ needs.conan-recipe-version.outputs.project_name }}
build_id: 2
runs_on: 'ubuntu-22.04'
python_version: '3.10.x'
conan_logging_level: 'info'
secrets: inherit

conan-package-create-linux:
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux) }}
needs: [ conan-recipe-version, conan-package-export ]

uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
project_name: ${{ needs.conan-recipe-version.outputs.project_name }}
build_id: 1
runs_on: 'ubuntu-20.04'
python_version: '3.10.x'
conan_logging_level: 'info'
secrets: inherit

notify-export:
if: ${{ always() }}
needs: [ conan-recipe-version, conan-package-export ]

uses: ultimaker/cura/.github/workflows/notify.yml@main
with:
success: ${{ contains(join(needs.*.result, ','), 'success') }}
success_title: "New Conan recipe exported in ${{ github.repository }}"
success_body: "Exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
failure_title: "Failed to export Conan Export in ${{ github.repository }}"
failure_body: "Failed to exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
secrets: inherit

notify-create:
if: ${{ always() && ((github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux)) }}
needs: [ conan-recipe-version, conan-package-create-macos, conan-package-create-windows, conan-package-create-linux, conan-package-create-linux-modern ]

uses: ultimaker/cura/.github/workflows/notify.yml@main
with:
success: ${{ contains(join(needs.*.result, ','), 'success') }}
success_title: "New binaries created in ${{ github.repository }}"
success_body: "Created binaries for ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
failure_title: "Failed to create binaries in ${{ github.repository }}"
failure_body: "Failed to created binaries for ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
secrets: inherit
conan-package:
uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@main
secrets: inherit
1 change: 0 additions & 1 deletion .github/workflows/requirements-conan-package.txt

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/unit-test-post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: unit-test-post

on:
workflow_run:
workflows: [ unit-test ]
types: [ completed ]

jobs:
publish-test-results:
uses: ultimaker/cura-workflows/.github/workflows/unit-test-post.yml@main
with:
event: ${{ github.event.workflow_run.event }}
conclusion: ${{ github.event.workflow_run.conclusion }}
secrets: inherit
179 changes: 47 additions & 132 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,137 +1,52 @@
---
name: unit-test
# FIXME: This should be a reusable workflow

on:
push:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'cmake/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/unit-test.yml'
- '.github/workflows/requirements*'
branches:
- main
- master
- 'CURA-*'
- '[0-9].[0-9]'
- '[0-9].[0-9][0-9]'
tags:
- '[0-9].[0-9].[0-9]'
- '[0-9].[0-9][0-9].[0-9]'
pull_request:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'cmake/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/unit-test.yml'
- '.github/workflows/requirements*'
branches:
- main
- master
- '[0-9].[0-9]'
- '[0-9].[0-9][0-9]'
tags:
- '[0-9].[0-9].[0-9]'
- '[0-9].[0-9][0-9].[0-9]'

env:
CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
CONAN_LOG_RUN_TO_OUTPUT: 1
CONAN_LOGGING_LEVEL: info
CONAN_NON_INTERACTIVE: 1
push:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'cmake/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/unit-test.yml'
- '.github/workflows/requirements*'
branches:
- main
- master
- 'CURA-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'
tags:
- '[0-9].[0-9].[0-9]'
- '[0-9].[0-9][0-9].[0-9]'
pull_request:
paths:
- 'src/**'
- 'include/**'
- 'test_package/**'
- 'tests/**'
- 'cmake/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/unit-test.yml'
- '.github/workflows/requirements*'
branches:
- main
- master
- 'CURA-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'
tags:
- '[0-9].[0-9].[0-9]'
- '[0-9].[0-9][0-9].[0-9]'

jobs:
conan-recipe-version:
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
with:
project_name: savitar

testing:
runs-on: ubuntu-20.04
needs: [ conan-recipe-version ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python and pip
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
architecture: 'x64'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements-conan-package.txt

- name: Install Python requirements and Create default Conan profile
run: |
pip install -r requirements-conan-package.txt
conan profile new default --detect
working-directory: .github/workflows/

- name: Use Conan download cache (Bash)
if: ${{ runner.os != 'Windows' }}
run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"

- name: Cache Conan local repository packages (Bash)
uses: actions/cache@v3
if: ${{ runner.os != 'Windows' }}
with:
path: |
$HOME/.conan/data
$HOME/.conan/conan_download_cache
key: conan-${{ runner.os }}-${{ runner.arch }}

- name: Install Linux system requirements
if: ${{ runner.os == 'Linux' }}
run: sudo apt install build-essential checkinstall zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev -y

- name: Get Conan configuration
run: conan config install https://github.com/Ultimaker/conan-config.git

- name: Install dependencies
run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_testing=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv

- name: Upload the Dependency package(s)
run: conan upload "*" -r cura --all -c

- name: Set Environment variables from Conan install (bash)
if: ${{ runner.os != 'Windows' }}
run: |
. ./activate_github_actions_runenv.sh
. ./activate_github_actions_buildenv.sh
working-directory: build/Release/generators/

- name: Build Unit Test
run: |
cmake --preset release
cmake --build --preset release
- name: Run Unit Test
id: run-test
run: ctest --output-junit engine_test.xml
working-directory: build/Release/

- name: Publish Unit Test Results
id: test-results
uses: EnricoMi/publish-unit-test-result-action@v1
if: ${{ always() }}
with:
files: |
**/*.xml
- name: Conclusion
run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}"
testing:
name: Run unit tests
uses: ultimaker/cura-workflows/.github/workflows/unit-test.yml@main
with:
test_use_ctest: true
Loading

0 comments on commit 4a8f633

Please sign in to comment.