Skip to content

Commit 32ded39

Browse files
committed
Set a build directory for cmake
1 parent 98b4e33 commit 32ded39

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Build/Test
22

33
on: [push, pull_request]
44

5+
env:
6+
BUILD_DIR: _build
7+
58
jobs:
69
build-test-unix:
710
if:
8-
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
9-
github.repository
11+
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
1012

1113
runs-on: ${{ matrix.os }}
1214

@@ -25,7 +27,7 @@ jobs:
2527
steps:
2628
- uses: actions/checkout@v4
2729

28-
- uses: mamba-org/setup-micromamba@v1
30+
- uses: mamba-org/setup-micromamba@v2
2931
with:
3032
micromamba-version: latest
3133
environment-name: testing
@@ -35,19 +37,14 @@ jobs:
3537
fortran-compiler
3638
bmi-fortran
3739
38-
- name: Make CMake build directory
39-
run: cmake -E make_directory build
40-
41-
- name: Configure CMake
42-
working-directory: ${{ github.workspace }}/build
40+
- name: Configure project
4341
run: |
44-
cmake $GITHUB_WORKSPACE \
42+
cmake $GITHUB_WORKSPACE -B ${{ env.BUILD_DIR }} \
4543
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
4644
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
4745
48-
- name: Build
49-
working-directory: ${{ github.workspace }}/build
50-
run: cmake --build . --target install --config ${{ matrix.build-type }}
46+
- name: Build and install project
47+
run: cmake --build ${{ env.BUILD_DIR }} --target install --config ${{ matrix.build-type }}
5148

5249
- name: Test for installed files
5350
run: |
@@ -58,9 +55,8 @@ jobs:
5855
test -f $CONDA_PREFIX/include/bmiheatf.mod
5956
test -f $CONDA_PREFIX/lib/pkgconfig/bmiheatf.pc
6057
61-
- name: Run CTest
62-
working-directory: ${{ github.workspace }}/build
63-
run: ctest -C ${{ matrix.build-type }} --output-on-failure
58+
- name: Run project tests
59+
run: ctest --test-dir ${{ env.BUILD_DIR }} -C ${{ matrix.build-type }} --output-on-failure
6460

6561
- name: Memcheck
6662
if: matrix.os == 'ubuntu-latest'
@@ -78,8 +74,7 @@ jobs:
7874
7975
build-test-windows:
8076
if:
81-
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
82-
github.repository
77+
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
8378

8479
runs-on: windows-latest
8580

0 commit comments

Comments
 (0)