[DRAFT] Replace Conan with vcpkg #1283
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: "Pull Request Test" | |
on: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- id: file_changes | |
uses: tj-actions/changed-files@v44 | |
- uses: pre-commit/action@v3.0.1 | |
with: | |
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files}} | |
build-linux: | |
name: Build Linux | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip modules | |
id: cache-pip | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-pip-modules | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: "Install system dependencies" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
cmake ninja-build build-essential \ | |
pkg-config autoconf automake libtool \ | |
zip unzip \ | |
bison swig \ | |
libx11-dev libxft-dev libxext-dev libgles2-mesa-dev \ | |
libxi-dev libxtst-dev libxrandr-dev \ | |
gtk2.0 libgtk2.0-dev \ | |
python3-setuptools python3-jinja2 python3-tk | |
- # https://github.com/lukka/CppBuildTasks-Validation/blob/v10/.github/workflows/hosted-ninja-vcpkg.yml | |
name: "Install vcpkg" | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | |
vcpkgJsonGlob: "src/vcpkg.json" | |
vcpkgConfigurationJsonGlob: "src/vcpkg-configuration.json" | |
- name: "Create virtual Environment" | |
run: | | |
python${{ matrix.python-version }} -m venv .venv | |
source .venv/bin/activate | |
echo "VIRTUAL ENV:" $VIRTUAL_ENV | |
- name: "Install required Python dependencies" | |
run: source .venv/bin/activate && pip3 install -r requirements.txt | |
- name: "Generate build recipes" | |
run: source .venv/bin/activate && cmake -S src/ -B dist3/ --preset base | |
- name: "Build basilisk" | |
run: source .venv/bin/activate && cmake --build dist3/ | |
- name: "Run Python Tests" | |
run: | | |
source .venv/bin/activate | |
cd src && pytest -n auto -m "not scenarioTest" --junitxml=../junit/test-results-${{ matrix.python-version }}.xml | |
- name: "Upload pytest test results" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
- name: "Run C/C++ Tests" | |
working-directory: ./dist3 | |
run: ctest | |
if: ${{ always() }} | |
build-windows: | |
if: 'false' | |
name: Build Windows | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
env: | |
MPLBACKEND: agg | |
CONAN_USER_HOME: C:\Users\runneradmin\ | |
CONAN_USER_HOME_SHORT: None | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: '**/requirements.txt' | |
- name: Cache conan packages | |
id: cache-conan | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-conan-packages | |
with: | |
path: C:\Users\runneradmin\.conan | |
key: | |
conan-packages-${{ runner.os }}-hash-${{ hashFiles('conanfile.py') }} | |
restore-keys: | | |
conan-packages-${{ runner.os }}-hash- | |
- name: Choco help | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: -h | |
- name: "Install swig and cmake" | |
shell: pwsh | |
run: choco install swig cmake -y | |
- name: "Create python virtual env" | |
shell: pwsh | |
run: python -m venv venv | |
- name: "Install wheel and conan package" | |
shell: pwsh | |
run: | | |
venv\Scripts\activate | |
pip install -r requirements.txt | |
- name: "Add basilisk and cmake path to env path" | |
shell: pwsh | |
run: | | |
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path | |
$newpath = “$oldpath;${{ env.GITHUB_WORKSPACE }}\dist3\Basilisk;C:\Program Files\CMake\bin” | |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath | |
- name: "Build basilisk" | |
shell: pwsh | |
run: | | |
venv\Scripts\activate | |
python conanfile.py --opNav True | |
- name: "Test Simulation Python" | |
shell: pwsh | |
run: | | |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name MPLBACKEND -Value ${MPLBACKEND} | |
venv\Scripts\activate | |
cd src\simulation | |
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto -m "not scenarioTest"; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}} | |
- name: "Python Architecture Tests" | |
shell: pwsh | |
run: | | |
venv\Scripts\activate | |
cd src\architecture | |
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}} | |
- name: "Python FswAlgorithms Tests" | |
shell: pwsh | |
run: | | |
venv\Scripts\activate | |
cd src\fswAlgorithms | |
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}} | |
- name: "C/C++ Tests" | |
shell: pwsh | |
run: | | |
cd dist3 | |
ctest | |
if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1} |