1+ name : Build and Test ldsCtrlEst
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ workflow_dispatch :
9+
10+ jobs :
11+ build :
12+ strategy :
13+ matrix :
14+ os : [ubuntu-latest, macos-latest, windows-latest]
15+
16+ runs-on : ${{ matrix.os }}
17+
18+ steps :
19+ - name : Checkout repository
20+ uses : actions/checkout@v3
21+ with :
22+ submodules : recursive
23+
24+ - name : Cache vcpkg binaries
25+ uses : actions/cache@v3
26+ with :
27+ path : ${{ runner.os == 'Windows' && 'C:\\Users\\runneradmin\\AppData\\Local\\vcpkg\\' || '~/.cache/vcpkg' }}
28+ key : vcpkg-binary-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}
29+ restore-keys : |
30+ vcpkg-binary-${{ matrix.os }}-
31+ - name : Cache vcpkg directory
32+ uses : actions/cache@v3
33+ with :
34+ path : vcpkg
35+ key : vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}
36+ restore-keys : |
37+ vcpkg-${{ matrix.os }}-
38+ - name : Set up vcpkg for Windows
39+ if : runner.os == 'Windows'
40+ shell : pwsh
41+ run : |
42+ if (Test-Path -Path "vcpkg") {
43+ Remove-Item -Recurse -Force "vcpkg"
44+ }
45+ git clone https://github.com/microsoft/vcpkg.git
46+ cd vcpkg
47+ .\bootstrap-vcpkg.bat
48+ .\vcpkg integrate install
49+ - name : Set up vcpkg for macOS/Linux
50+ if : runner.os != 'Windows'
51+ run : |
52+ rm -rf vcpkg
53+ git clone https://github.com/microsoft/vcpkg.git
54+ cd vcpkg
55+ ./bootstrap-vcpkg.sh
56+ ./vcpkg integrate install
57+ - name : Set up dependencies for macOS and Linux
58+ if : runner.os != 'Windows'
59+ run : |
60+ if [ "${{ runner.os }}" == "macOS" ]; then
61+ brew install cmake gfortran curl zip unzip gnu-tar
62+ elif [ "${{ runner.os }}" == "Linux" ]; then
63+ sudo apt-get update
64+ sudo apt-get install -y cmake gfortran pkg-config build-essential
65+ fi
66+ - name : Set up dependencies for Windows
67+ if : runner.os == 'Windows'
68+ run : |
69+ choco install cmake git
70+ - name : Cache build directory
71+ uses : actions/cache@v3
72+ with :
73+ path : build
74+ key : build-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }}
75+ restore-keys : |
76+ build-${{ matrix.os }}-
77+ - name : Configure and build for macOS/Linux
78+ if : runner.os != 'Windows'
79+ run : |
80+ mkdir -p build && cd build
81+ cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
82+ cmake --build . --config Release --parallel
83+ - name : Configure and build for Windows
84+ if : runner.os == 'Windows'
85+ shell : pwsh
86+ run : |
87+ if (Test-Path -Path "build") {
88+ Remove-Item -Recurse -Force "build"
89+ }
90+ mkdir build
91+ cd build
92+ cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
93+ cmake --build . --config Release --parallel
94+ - name : Install (Windows only)
95+ if : runner.os == 'Windows'
96+ run : |
97+ cd build
98+ cmake --install .
99+ - name : Add install directory to PATH (Windows only)
100+ if : runner.os == 'Windows'
101+ run : echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
102+
103+ - name : Run tests
104+ run : |
105+ cd build
106+ ctest -C Release
0 commit comments