Skip to content

Commit

Permalink
migration to conan 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardstock committed Jul 13, 2023
2 parents 39ca113 + 53f7dba commit 65d83a5
Show file tree
Hide file tree
Showing 37 changed files with 991 additions and 1,047 deletions.
92 changes: 0 additions & 92 deletions .circleci/config.yml

This file was deleted.

76 changes: 0 additions & 76 deletions .circleci/deploy.sh

This file was deleted.

16 changes: 0 additions & 16 deletions .circleci/deploy_win.bat

This file was deleted.

16 changes: 0 additions & 16 deletions .circleci/setup.sh

This file was deleted.

6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# In this example, those users owns any file in an checking directory
# anywhere in your repository.

* @edwardstock
37 changes: 37 additions & 0 deletions .github/actions/build-cmake-target/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Build CMake target"
description: "Build and run project target"

inputs:
build-dir:
required: false
description: "Build directory"
default: "_build"
build-type:
required: false
description: "CMake build type"
default: "Release"
args:
required: false
description: "Extra cmake arguments"
default: ""
target:
required: true
description: "CMake target name"

runs:
using: composite
steps:
- name: Create build environment
shell: bash
id: create-build-env # adding an id for this step to reference it later
run: |
mkdir -p ${{ github.workspace }}/${{ inputs.build-dir }}
echo "work-dir=${{ github.workspace }}/${{ inputs.build-dir }}" >> $GITHUB_OUTPUT
- name: Configure
working-directory: ${{ steps.create-build-env.outputs.work-dir }} # using output variable
shell: bash
run: cmake .. -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} ${{ inputs.args }}
- name: Build target
working-directory: ${{ steps.create-build-env.outputs.work-dir }} # using output variable
shell: bash
run: cmake --build . --target ${{ inputs.target }}
52 changes: 52 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Run Tests"
description: "Build and run project tests"

inputs:
build-dir:
required: false
description: "Build directory"
default: "_test_build"
cmake-args:
required: false
description: "Test cmake arguments"
default: "-Dtoolbox_BUILD_TESTS=On"
test-target:
required: false
description: "Test binary name"
default: "toolbox-test"
test-binary:
required: false
description: "Test binary name"
default: "toolbox-test"
conan-enabled:
required: false
description: "Enable conan"
default: "true"

runs:
using: composite
steps:
- name: Create test environment
shell: bash
id: create-test-env # adding an id for this step to reference it later
run: |
mkdir -p ${{ github.workspace }}/${{ inputs.build-dir }}
echo "work-dir=${{ github.workspace }}/${{ inputs.build-dir }}" >> $GITHUB_OUTPUT
- name: Configure project with tests (conan build)
if: ${{ inputs.conan-enabled }}
working-directory: ${{ steps.create-test-env.outputs.work-dir }} # using output variable
shell: bash
run: cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=modules/conan_provider.cmake -DCMAKE_BUILD_TYPE=Debug ${{ inputs.cmake-args }}
- name: Configure project with tests
if: ${{ !inputs.conan-enabled }}
working-directory: ${{ steps.create-test-env.outputs.work-dir }} # using output variable
shell: bash
run: cmake .. -DCMAKE_BUILD_TYPE=Debug ${{ inputs.cmake-args }}
- name: Build target
working-directory: ${{ steps.create-test-env.outputs.work-dir }} # using output variable
shell: bash
run: cmake --build . --target ${{ inputs.test-target }}
- name: Run tests
shell: bash
run: |
${{ steps.create-test-env.outputs.work-dir }}/bin/${{ inputs.test-binary }}
19 changes: 19 additions & 0 deletions .github/actions/setup-conan/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Setup Conan"
description: "Upgrade pip, install conan, setup remote and login to artifactory"

inputs:
artifactory_api_key:
required: true
description: "Artifactory API key"

runs:
using: composite
steps:
- name: Setup Conan
shell: bash
run: |
pip install --upgrade pip
pip install conan
conan profile detect --force
conan remote add edwardstock https://conan.edwardstock.com/artifactory/api/conan/conan-local
conan remote login -p ${{ inputs.artifactory_api_key }} edwardstock admin
10 changes: 10 additions & 0 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Setup Python 3.11"
description: "Install python 3.11"

runs:
using: composite
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
40 changes: 40 additions & 0 deletions .github/workflows/build_conan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build & Test

on:
push:
branches:
- master

jobs:
build-and-test-linux-gcc:
name: Build Conan Packages with GCC
runs-on: ubuntu-20.04
strategy:
matrix:
gcc: [ 7, 8, 9, 10, 11 ]
steps:
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest

- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.gcc }}
platform: x64

- name: Setup Python
uses: ./.github/actions/setup-python

- name: Setup Conan
uses: ./.github/actions/setup-conan
with:
artifactory_api_key: ${{ secrets.ARTIFACTORY_API_KEY }}

- name: Run Tests
uses: ./.github/actions/run-tests

- name: Build deploy artifacts
run: $(which python3) ${{ github.workspace }}/deploy.py build

- name: Upload deploy artifacts
run: $(which python3) ./deploy.py upload
Loading

0 comments on commit 65d83a5

Please sign in to comment.