Update build.yaml for Test on Windows #197
Workflow file for this run
This file contains hidden or 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: C++ CI with Docker | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
# Only run Docker steps on Linux | |
- name: Login to Docker Hub | |
if: runner.os == 'Linux' | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Test the Docker image | |
if: runner.os == 'Linux' | |
run: docker build -t astomodynamics/cddp-cpp . | |
- name: Push the Docker image (optional) | |
if: runner.os == 'Linux' | |
run: docker push astomodynamics/cddp-cpp | |
# For macOS, build directly without Docker | |
- name: Install dependencies on macOS | |
if: runner.os == 'macOS' | |
run: | | |
# Basic dependencies | |
brew install eigen cmake | |
# Dependencies for matplotplusplus | |
brew install gnuplot | |
- name: Build on macOS | |
if: runner.os == 'macOS' | |
run: | | |
mkdir -p build && cd build | |
cmake .. | |
make -j4 | |
# For Windows, build using MSVC and vcpkg or choco for dependencies | |
- name: Install dependencies on Windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
choco install eigen -y | |
# Dependencies for matplotplusplus | |
choco install gnuplot -y | |
- name: Build on Windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
mkdir -Force build | |
cd build | |
cmake .. | |
cmake --build . --config Release |