Skip to content

Commit f379cb9

Browse files
authored
Update ci.yml
change order of build and unit tests update names and error messages for clarity
1 parent 94730e5 commit f379cb9

File tree

1 file changed

+51
-53
lines changed

1 file changed

+51
-53
lines changed

Diff for: .github/workflows/ci.yml

+51-53
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,83 @@ on:
44
push:
55
branches:
66
- master
7-
87
pull_request:
98

109
jobs:
11-
12-
# Build and run unit tests
13-
test:
10+
# Build and Integration Test
11+
build_integration_test:
1412
strategy:
1513
fail-fast: false
1614
matrix:
17-
OS:
15+
OS:
1816
- macos-latest
1917
- ubuntu-latest
2018
- ubuntu-20.04
21-
2219
runs-on: ${{ matrix.OS }}
2320

2421
steps:
2522
# checkout source code
2623
- uses: actions/checkout@v2
2724

28-
# compile tests
29-
- name: compile tests
30-
run: make test
25+
# install doxygen
26+
- name: Install Doxygen
27+
run: |
28+
if [[ "$RUNNER_OS" == "Linux" ]]; then
29+
sudo apt-get install doxygen -y
30+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
31+
brew install --formula doxygen
32+
fi
33+
34+
# compile SIPNET
35+
- name: compile sipnet
36+
run: make
3137

32-
# run tests
33-
- name: run tests
34-
run: make testrun
38+
# remove existing test output file
39+
- name: Remove Niwout Output File
40+
run: rm Sites/Niwot/niwot.out
41+
42+
# run single sipnet run
43+
- name: Run SIPNET on Sites/Niwot/niwot
44+
run: ./sipnet
45+
46+
# check for correct output of Niwot run
47+
- name: Check if niwot.out is generated
48+
if: ${{ !files.exists('Sites/Niwot/niwot.out') }}
49+
run: |
50+
echo "::error title={No Output}::Test run for Niwot site failed to produce output"
51+
exit 1
52+
# Check if niwot.out has changed
53+
- name: Check whether niwot.out has changed
54+
shell: bash
55+
run: |
56+
if git diff --exit-code Sites/Niwot/niwot.out; then
57+
echo "Success: Niwot.out created and has not changed"
58+
else
59+
echo "::error title={Output Changed}::The test file niwot.out has changed. This is expected to fail with some changes to SIPNET. When this happens, assess correctness and then update the reference niwot.out."
60+
exit 1
61+
fi
3562
36-
# try to build SIPNET on Ubuntu & MacOS
37-
build:
63+
# Run Unit Tests
64+
test:
65+
needs: build_integration_test
3866
strategy:
3967
fail-fast: false
4068
matrix:
41-
OS:
69+
OS:
4270
- macos-latest
4371
- ubuntu-latest
4472
- ubuntu-20.04
45-
4673
runs-on: ${{ matrix.OS }}
4774

4875
steps:
49-
# checkout source code
50-
- uses: actions/checkout@v2
51-
52-
# install doxygen
53-
- name: Install Doxygen
54-
run: |
55-
if [[ "$RUNNER_OS" == "Linux" ]]; then
56-
sudo apt-get install doxygen -y
57-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
58-
brew install --formula doxygen
59-
fi
60-
61-
# compile SIPNET
62-
- name: compile sipnet
63-
run: make
76+
# checkout source code
77+
- uses: actions/checkout@v2
6478

65-
# remove existing test output file
66-
- name: Remove Niwout Output File
67-
run: rm Sites/Niwot/niwot.out
79+
# compile unit tests
80+
- name: compile tests
81+
run: make test
6882

69-
# run single sipnet run
70-
- name: sipnet on Sites/Niwot/niwot
71-
run: ./sipnet
83+
# run tests
84+
- name: Run Unit Tests
85+
run: make testrun
7286

73-
# check output of test
74-
- name: fail if no niwot output exists
75-
if: ${{ hashFiles('Sites/Niwot/niwot.out') == '' }}
76-
run: |
77-
echo "::error title={No Output}::Test run for Niwot site failed to produce output"
78-
exit 1
79-
# check whether niwot.out has changed
80-
- name: Check whether niwot.out has changed
81-
shell: bash
82-
run: |
83-
if git diff --exit-code Sites/Niwot/niwot.out; then
84-
echo "Success: Niwot.out created and has not changed"
85-
else
86-
echo "::error title={Output Changed}::The test file niwot.out has changed"
87-
exit 1
88-
fi

0 commit comments

Comments
 (0)