merge develop #3
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 packaging | |
on: | |
workflow_call: | |
inputs: | |
public_artifactory: | |
type: boolean | |
default: false | |
os: | |
required: true | |
type: string | |
default: ubuntu-22.04 | |
compiler: | |
type: string | |
default: clang-17 | |
cmake-version: | |
type: string | |
default: 3.24.0 | |
conan-version: | |
type: string | |
default: 2.3.0 | |
conan-options: | |
type: string | |
secrets: | |
CONAN_USER: | |
required: true | |
CONAN_PW: | |
required: true | |
jobs: | |
publish-conan-branch-package: | |
name: Creates a conan package for the branch and uploads it to conan.dice-research.org | |
runs-on: ${{ inputs.os }} | |
steps: | |
# setup env | |
- name: Install tools and requirements | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq python3 python3-pip | |
- name: Add repos for for gcc-13 and clang-16,17 | |
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/setup_apt | |
- name: Ensure stdlib version | |
run: | | |
sudo apt-get install -y libstdc++-13-dev | |
- name: Get minimum cmake version | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: ${{ inputs.cmake-version }} | |
- name: Install compiler | |
id: install_cc | |
uses: rlalik/[email protected] | |
with: | |
compiler: ${{ inputs.compiler }} | |
- name: Install mold | |
uses: rui314/setup-mold@v1 | |
- name: Install conan | |
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/configure_conan | |
with: | |
conan-version: ${{ inputs.conan-version }} | |
- name: add conan user | |
run: | | |
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris | |
conan remote login -p "${{ secrets.CONAN_PW }}" dice-group "${{ secrets.CONAN_USER }}" | |
conan remote add tentris-private https://conan.dice-research.org/artifactory/api/conan/tentris-private | |
conan remote login -p "${{ secrets.CONAN_PW }}" tentris-private "${{ secrets.CONAN_USER }}" | |
- name: Cache conan data | |
id: cache-conan | |
uses: actions/cache@v3 | |
with: | |
path: ~/.conan2/p | |
key: ${{ inputs.os }}-${{ inputs.compiler }}-reusable-workflow-branch-package | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Collect package information | |
shell: bash | |
run: | | |
pkg_name=$(conan inspect --format json . | jq -r '.name') | |
pkg_ver=$(conan inspect --format json . | jq -r '.version') | |
# we replace / with - because it is a reserved name in conan's <pkgName>/version@user/channel | |
conanized_branch_name=$(echo "${{ github.ref_name }}" | sed 's|/|-|g' | awk '{print tolower($0)}' | head -c 51) | |
echo "conan_package_user=${{ github.repository_owner }}" >> $GITHUB_ENV | |
echo "conan_package_channel=$conanized_branch_name" >> $GITHUB_ENV | |
echo "conan_package_identifier=${pkg_name}/${pkg_ver}@${{ github.repository_owner }}/${conanized_branch_name}" >> $GITHUB_ENV | |
- name: Create Package | |
shell: bash | |
env: | |
CC: ${{ steps.install_cc.outputs.cc }} | |
CXX: ${{ steps.install_cc.outputs.cxx }} | |
run: | | |
(conan remove -f "${{ env.conan_package_identifier }}:*" || true) | |
conan create --user "${{ env.conan_package_user }}" --channel "${{ env.conan_package_channel }}" --build missing ${{ inputs.conan-options }} . | |
- name: Select public artifactory for upload | |
if: ${{ fromJSON(inputs.public_artifactory) }} | |
run: | | |
echo "remote_artifactory_name=dice-group" >> $GITHUB_ENV | |
- name: Select private artifactory for upload | |
if: ${{ !fromJSON(inputs.public_artifactory) }} | |
run: | | |
echo "remote_artifactory_name=tentris-private" >> $GITHUB_ENV | |
- name: Upload to artifactory | |
shell: bash | |
run: | | |
conan upload "${{ env.conan_package_identifier }}" --force -r ${{ env.remote_artifactory_name }} --only-recipe |