Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jellespijker authored Dec 8, 2023
2 parents 92cea65 + 2276568 commit 26c410e
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 557 deletions.
150 changes: 19 additions & 131 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,170 +1,58 @@
name: Benchmark

on:
push:
paths:
- 'include/**'
- 'src/**'
- 'benchmark/**'
- '.github/workflows/benchmark.yml'
- '.github/workflows/requirements-conan-package.txt'
branches:
- main
tags:
- '[0-9].[0-9].[0-9]*'

pull_request:
types: [ opened, reopened, synchronize ]
paths:
- 'include/**'
- 'src/**'
- 'benchmark/**'
- '.github/workflows/benchmark.yml'
- '.github/workflows/requirements-conan-package.txt'
branches:
- main
- 'CURA-*'
- 'PP-*'
- '[0-9]+.[0-9]+'
tags:
- '[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: write
deployments: write

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
CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }}
CONAN_PASSWORD: ${{ secrets.CONAN_PASS }}


jobs:
check_actor:
runs-on: ubuntu-latest
outputs:
proceed: ${{ steps.skip_check.outputs.proceed }}
steps:
- id: skip_check
run: |
if [[ "${{ github.actor }}" == *"[bot]"* ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request }}" == "" ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]]; then
echo "proceed=true" >> $GITHUB_OUTPUT
else
echo "proceed=false" >> $GITHUB_OUTPUT
fi
shell: bash
uses: ultimaker/cura-workflows/.github/workflows/check-actor.yml@main
secrets: inherit

conan-recipe-version:
needs: [ check_actor ]
if: ${{ needs.check_actor.outputs.proceed == 'true' }}
uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
with:
project_name: curaengine

benchmark:
needs: [ conan-recipe-version ]
name: Run C++ benchmark
runs-on: ubuntu-22.04
steps:
- name: Checkout CuraEngine
uses: actions/checkout@v3

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

- name: Cache Benchmark library
uses: actions/cache@v1
with:
path: ./cache
key: ${{ runner.os }}-googlebenchmark-v1.5.0

- name: Install Python requirements and Create default Conan profile
run: |
pip install -r .github/workflows/requirements-conan-package.txt
# NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest.
# This is maybe because grub caches the disk it uses last time, which is recreated each time.
- name: Install Linux system requirements
if: ${{ runner.os == 'Linux' }}
run: |
sudo rm /var/cache/debconf/config.dat
sudo dpkg --configure -a
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt upgrade
sudo apt install build-essential checkinstall libegl-dev 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 pkg-config -y
- name: Install GCC-132 on ubuntu
run: |
sudo apt install g++-13 gcc-13 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
- name: Create the default Conan profile
run: conan profile new default --detect

- name: Get Conan configuration
run: |
conan config install https://github.com/Ultimaker/conan-config.git
conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}"
- 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 dependencies
run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_benchmarks=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 CuraEngine and tests
run: |
cmake --preset release
cmake --build --preset release
- name: Run benchmark CuraEngine
id: run-test
run: ./benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json
working-directory: build/Release/benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: C++ Benchmark
output-file-path: build/Release/benchmark/benchmark_result.json
gh-repository: github.com/Ultimaker/CuraEngineBenchmarks
gh-pages-branch: main
benchmark-data-dir-path: dev/bench
tool: 'googlecpp'
github-token: ${{ secrets.CURA_BENCHMARK_PAT }}
auto-push: true
# alert-threshold: '175%'
# summary-always: true
# comment-on-alert: true
max-items-in-chart: 250
uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
conan_extra_args: "-o curaengine:enable_benchmarks=True"
benchmark_cmd: "benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json"
name: "C++ Benchmark"
output_file_path: "build/Release/benchmark_result.json"
data_dir: "dev/bench"
tool: "googlecpp"
secrets: inherit
110 changes: 13 additions & 97 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
@@ -1,143 +1,59 @@
---
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. "curaengine/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:
- 'include/**'
- 'src/**'
- 'cmake/**'
- 'tests/**'
- 'test_package/**'
- 'conanfile.py'
- 'conandata.yml'
- 'CMakeLists.txt'
- '.github/workflows/conan-package.yml'
- '.github/worflows/requirements-conan-package.txt'
branches:
- main
- 'CURA-*'
- '[1-9].[0-9]*'
- '[1-9].[0-9][0-9]*'
- 'PP-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'
tags:
- '[1-9]+.[0-9]+.[0-9]*'
- '[1-9]+.[0-9]+.[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
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
with:
project_name: curaengine

conan-package-export:
needs: [ conan-recipe-version ]
uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@main
uses: ultimaker/cura-workflows/.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-22.04'
python_version: '3.11.x'
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
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.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.11.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
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.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.11.x'
conan_config_branch: ''
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
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.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: 2
runs_on: 'ubuntu-22.04'
python_version: '3.11.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 ]

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
Loading

0 comments on commit 26c410e

Please sign in to comment.