Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Use conan_provider for running conan #40

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 32 additions & 77 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,108 +3,63 @@ name: Build
on: [push, pull_request]

jobs:
build-msvc:
name: Windows
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
BUILD_TOOLS_PATH: C:\Program Files\Conan\conan
CONAN_USER_HOME_SHORT: None
runs-on: windows-latest
BUILD_TOOLS_PATH: C:\apps\build-tools\
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.addPath(process.env.BUILD_TOOLS_PATH);
- run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: startsWith(matrix.os, 'windows')

- uses: actions/checkout@v4

- name: Cache conan
uses: actions/cache@v4
with:
key: conan-win-${{ hashFiles('conanfile.txt') }}
key: conan-${{ matrix.os }}-${{ hashFiles('conanfile.txt') }}
path: ~/.conan2/

- name: Install dependencies
run: choco install conan ninja -y

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1

- name: Build
run: |
conan install . -b missing -pr:b=tools/conan-profiles/vs-22-release-ninja -pr=tools/conan-profiles/vs-22-release-ninja
cmake --preset conan-release -DBUILD_TEST=ON
ninja

- name: Test
run: ctest -j2 --output-on-failure

- name: Clean Conan pkgs
run: conan cache clean "*" -sbd

build-gcc:
name: Linux
env:
CONAN_SYSREQUIRES_MODE: "enabled"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
sudo apt-get update
sudo apt-get -y install ninja-build
conan profile detect --force
echo "tools.system.package_manager:mode = install" > ~/.conan2/global.conf
echo "tools.system.package_manager:sudo = True" >> ~/.conan2/global.conf

- name: Cache conan
uses: actions/cache@v4
with:
key: conan-linux-${{ hashFiles('conanfile.txt') }}
path: ~/.conan2/
- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd
run: git clone https://git.anotherfoxguy.com/AnotherFoxGuy/build-tools.git %BUILD_TOOLS_PATH%

- name: Install dependencies
run: |
sudo apt-get update
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-cmake.sh" | sudo bash
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
sudo apt-get -y install ninja-build
if: startsWith(matrix.os, 'macos')
run: brew install conan ninja

- name: Configure
run: |
conan profile detect --force
conan install . -s build_type=Release -b missing -pr:b=default -c tools.cmake.cmaketoolchain:generator="Ninja"
cmake --preset conan-release -DBUILD_TEST=ON
cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -Bbuild -DBUILD_TEST=ON -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="cmake/conan_provider.cmake"

- name: Build
run: |
cd build
ninja

- name: Test
run: ctest -j2 --output-on-failure

- name: Clean Conan pkgs
run: conan cache clean "*" -sbd

build-appleclang:
name: MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Cache conan
uses: actions/cache@v4
with:
key: conan-mac-${{ hashFiles('conanfile.txt') }}
path: ~/.conan2/

- name: Install dependencies
run: brew install conan ninja

- name: Build
run: |
conan profile detect --force
conan install . -s build_type=Release -b missing -pr:b=default -c tools.cmake.cmaketoolchain:generator="Ninja"
cmake --preset conan-release -DBUILD_TEST=ON
ninja
shell: bash

- name: Test
run: ctest -j2 --output-on-failure
shell: bash
cd build
ctest --output-on-failure

- name: Clean Conan pkgs
run: conan cache clean "*" -sbd
run: conan cache clean "*" -sbd
21 changes: 2 additions & 19 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ jobs:
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/mofilereader -O run-sonar-scanner
sudo chmod 777 run-sonar-scanner

- name: Prepare cfamily cache timestamp
id: cfamily_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")

- name: cfamily cache files
uses: actions/cache@v4
with:
path: cfamily-cache
key: cfamily-cache-${{ steps.cfamily_cache_timestamp.outputs.timestamp }}
restore-keys: |
cfamily-cache-

- name: Cache conan
uses: actions/cache@v4
with:
Expand All @@ -54,16 +39,14 @@ jobs:

- name: Configure
run: |
conan profile detect --force
conan install . -s build_type=Release -b missing -pr:b=default
cmake --preset conan-release -DBUILD_TEST=ON -DENABLE_COVERAGE=ON
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=ON -DENABLE_COVERAGE=ON -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="cmake/conan_provider.cmake"

- name: Run build-wrapper
run: build-wrapper-linux-x86-64 --out-dir bw-output make -j4

- name: Test
continue-on-error: true
run: ctest -j2 --output-on-failure
run: ctest --output-on-failure

- name: Generate coverage
run: make gcov
Expand Down
Loading
Loading