Skip to content

Commit ecd9920

Browse files
Create ci.yaml (#38)
1 parent 4ee83af commit ecd9920

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: C++ CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# Test with and without LibTorch CPU and GPU
15+
include:
16+
- gurobi: "OFF"
17+
torch: "ON"
18+
torch_gpu: "ON"
19+
- gurobi: "OFF"
20+
torch: "ON"
21+
torch_gpu: "OFF"
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Install Gurobi (if needed)
27+
if: matrix.gurobi == 'ON'
28+
run: |
29+
# Replace this with the actual installation instructions for your Gurobi version
30+
wget -O gurobi.sh https://packages.gurobi.com/11.0/gurobi11.0.0_linux64.tar.gz
31+
chmod +x gurobi.sh
32+
sudo ./gurobi.sh
33+
# You might need to accept the license agreement interactively or by modifying the script
34+
# Ensure Gurobi is in the PATH or set GUROBI_ROOT appropriately
35+
36+
- name: Install dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y --no-install-recommends ${{{{ matrix.torch == 'ON' && matrix.torch_gpu == 'ON' ? 'cuda' : '' }}}} # Install CUDA if needed
40+
41+
- name: Configure CMake
42+
run: |
43+
cmake -B ${{ github.workspace }}/build \
44+
-DCMAKE_BUILD_TYPE=Release \
45+
-DCDDP-CPP_GUROBI=${{ matrix.gurobi }} \
46+
-DCDDP-CPP_BUILD_TESTS=ON \
47+
-DCDDP-CPP_TORCH=${{ matrix.torch }} \
48+
-DCDDP-CPP_TORCH_GPU=${{ matrix.torch_gpu }} \
49+
${{ matrix.gurobi == 'ON' ? '-DGUROBI_ROOT=/opt/gurobi' : '' }} # Adjust GUROBI_ROOT if necessary
50+
51+
- name: Build
52+
run: cmake --build ${{ github.workspace }}/build --config Release
53+
54+
- name: Test
55+
working-directory: ${{ github.workspace }}/build
56+
run: ctest -V

0 commit comments

Comments
 (0)