Skip to content

Commit

Permalink
Test build with conan2
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Feb 12, 2024
1 parent ba38419 commit 22b8523
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/actions/setup_conan2/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Setup Conan2'
description: 'Sets up Conan2 for Sisl Builds'
inputs:
platform:
description: 'Platform conan will be building on'
required: true
default: 'ubuntu-22.04'
runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.8"

- name: Setup Conan2
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install conan~=2.0
python -m pip install gcovr
conan profile detect --name default
- name: Fixup libstdc++
shell: bash
run: |
# Set std::string to non-CoW C++11 version
sed -i 's,compiler.libcxx=libstdc++$,compiler.libcxx=libstdc++11,g' ~/.conan2/profiles/default
if: ${{ inputs.platform == 'ubuntu-22.04' }}

128 changes: 128 additions & 0 deletions .github/workflows/build_dependencies2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Conan2 Build

on:
workflow_call:
inputs:
platform:
required: false
default: 'ubuntu-22.04'
type: string
branch:
required: true
type: string
build-type:
required: true
type: string
malloc-impl:
required: true
type: string
tooling:
required: false
type: string
default: 'None'
testing:
required: false
type: string
default: 'False'
workflow_dispatch:
inputs:
platform:
required: true
type: choice
options:
- ubuntu-22.04
- ubuntu-20.04
- macos-13
- macos-12
default: 'ubuntu-22.04'
branch:
required: true
type: string
build-type:
required: true
type: choice
options:
- Debug
- Release
- RelWithDebInfo
malloc-impl:
description: 'Allocation Library'
required: true
type: choice
options:
- libc
- tcmalloc
- jemalloc
tooling:
required: false
type: choice
- 'Sanitize'
- 'Coverage'
- 'None'
default: 'None'
testing:
description: 'Build and Run'
required: true
type: choice
options:
- 'True'
- 'False'
default: 'True'

jobs:
BuildSislDeps:
runs-on: ${{ inputs.platform }}
steps:
- name: Retrieve Code
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
if: ${{ inputs.testing == 'True' }}

- name: Retrieve Recipe
uses: actions/checkout@v3
with:
repository: eBay/sisl
ref: ${{ inputs.branch }}
if: ${{ inputs.testing == 'False' }}

- name: Setup Conan
uses: eBay/sisl/.github/actions/setup_conan2@conan2
with:
platform: ${{ inputs.platform }}
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Prepare Recipes
run: |
./prepare_v2.sh
cached_pkgs=$(ls -1d ~/.conan/data/*/*/*/*/export 2>/dev/null | sed 's,.*data/,,' | cut -d'/' -f1,2 | paste -sd',' - -)
echo "::info:: Pre-cached: ${cached_pkgs}"
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Create and Test Package
run: |
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
conan create \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o sisl/*:sanitize=${sanitize} \
-s:h build_type=${{ inputs.build-type }} \
--build missing \
.
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}

- name: Code Coverage Run
run: |
conan build
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o sisl/*:coverage=True \
-s:h build_type=${{ inputs.build-type }} \
--build missing \
.
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
gcov: true
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}
28 changes: 27 additions & 1 deletion .github/workflows/merge_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,36 @@ on:
workflow_dispatch:
push:
branches:
- stable/v8.x
- master

jobs:
BuildConan2:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-22.04"]
build-type: ["Release"]
malloc-impl: ["tcmalloc"]
tooling: ["None"]
exclude:
- build-type: Debug
tooling: None
- build-type: Debug
malloc-impl: tcmalloc
- build-type: Release
malloc-impl: libc
- build-type: Release
tooling: Sanitize
- build-type: Release
tooling: Coverage
uses: ./.github/workflows/build_dependencies2.yml
with:
platform: ${{ matrix.platform }}
branch: ${{ github.ref }}
build-type: ${{ matrix.build-type }}
malloc-impl: ${{ matrix.malloc-impl }}
tooling: ${{ matrix.tooling }}
testing: 'True'
Build:
strategy:
fail-fast: false
Expand Down

0 comments on commit 22b8523

Please sign in to comment.