Skip to content

Commit

Permalink
🔧 Use conan_provider for running conan
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Jan 8, 2025
1 parent 2988881 commit be8c7e2
Show file tree
Hide file tree
Showing 3 changed files with 710 additions and 96 deletions.
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

0 comments on commit be8c7e2

Please sign in to comment.