@@ -15,48 +15,146 @@ jobs:
1515 run :
1616 shell : bash
1717 steps :
18- - name : Checkout
19- uses : actions/checkout@v4
18+ - name : Harden Runner
19+ uses : step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
20+ with :
21+ disable-sudo : false
22+ egress-policy : block
23+ allowed-endpoints : >
24+ azure.archive.ubuntu.com:80
25+ esm.ubuntu.com:443
26+ files.pythonhosted.org:443
27+ github.com:443
28+ motd.ubuntu.com:443
29+ packages.microsoft.com:443
30+ pypi.org:443
31+
32+ - name : Checkout Repository
33+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
34+ with :
35+ persist-credentials : false
36+
2037 - name : Install linters
2138 run : |
2239 sudo apt-get update
2340 sudo apt-get install uncrustify cppcheck iwyu
24- - uses : actions/setup-python@v4
25- - name : Install pre-commit
41+
42+ - name : Set up Python3
43+ uses : actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
44+ with :
45+ python-version : ' 3.x'
46+
47+ - name : Run pre-commit hooks
48+ uses : pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
49+
50+ build-netcdf :
51+ name : Build (${{ matrix.build_type }}; ${{ matrix.os }}; NetCDF=True)
52+ needs : lint
53+ runs-on : ${{ matrix.os }}
54+ strategy :
55+ fail-fast : false
56+ matrix :
57+ os : [ "ubuntu-latest", "macos-latest" ]
58+ build_type : [ "Debug", "Release" ]
59+ steps :
60+ - name : Harden Runner
61+ uses : step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
62+ with :
63+ disable-sudo : false
64+ egress-policy : block
65+ allowed-endpoints : >
66+ azure.archive.ubuntu.com:80
67+ esm.ubuntu.com:443
68+ github.com:443
69+ motd.ubuntu.com:443
70+ packages.microsoft.com:443
71+ raw.githubusercontent.com:443
72+
73+ - name : Checkout Repository
74+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
75+ with :
76+ persist-credentials : false
77+
78+ - name : Install NetCDF (Ubuntu/apt)
79+ if : matrix.os == 'ubuntu-latest'
2680 run : |
27- python -m pip install --upgrade pip
28- python -m pip install pre-commit
29- - name : Run pre-commit
81+ sudo apt-get update
82+ sudo apt-get install -y libnetcdf-dev
83+ - name : Install NetCDF4 (macOS/homebrew)
84+ if : (matrix.os == 'macos-latest') && (!matrix.conda)
85+ uses : tecolicom/actions-use-homebrew-tools@b9c066b79607fa3d71e0be05d7003bb75fd9ff34 # v1.3.0
86+ with :
87+ tools : netcdf
88+ cache : " yes"
89+
90+ - name : Fetch NetCDF CMake script
3091 run : |
31- pre-commit run --all-files
92+ wget https://raw.githubusercontent.com/Kitware/VTK/master/CMake/FindNetCDF.cmake -P cmake
93+
94+ - name : Build
95+ id : build
96+ run : |
97+ mkdir build
98+ cd build
99+ cmake ..
100+ cmake --build . --config ${{ matrix.build_type }} -j 3 --verbose
101+
102+ - name : Run tests
103+ if : steps.build.outcome == 'success'
104+ run : |
105+ ./build/Raven
106+ ./build/Raven -v
32107
33108 build :
34- name : Build RavenHydroFramework binary (${{ matrix.build_type }})
35- runs-on : ubuntu-latest
109+ name : Build (${{ matrix.build_type }}; ${{ matrix.os }}; NetCDF=False)
110+ needs : lint
111+ runs-on : ${{ matrix.os }}
36112 strategy :
113+ fail-fast : false
37114 matrix :
38- build_type : [Debug, Release]
115+ os : [ ubuntu-latest, macos-latest, windows-latest ]
116+ build_type : [ Debug, Release ]
39117 defaults :
40118 run :
41- shell : bash
119+ shell : bash -l {0}
42120 steps :
43- - name : Checkout
44- uses : actions/checkout@v4
45- - name : Install dependencies
46- run : |
47- sudo apt-get update
48- sudo apt-get install libnetcdf-dev build-essential cmake
49- - name : Fetch NetCDF CMake script
50- run : |
51- wget https://raw.githubusercontent.com/Kitware/VTK/master/CMake/FindNetCDF.cmake -P cmake
52- - name : Build
53- id : build
54- continue-on-error : true
55- run : |
56- cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
57- make -j4
58- - name : Run tests
59- if : steps.build.outcome == 'success'
60- run : |
61- ./Raven
62- ./Raven -v
121+ - name : Harden Runner
122+ uses : step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
123+ with :
124+ disable-sudo : true
125+ egress-policy : block
126+ allowed-endpoints : >
127+ azure.archive.ubuntu.com:80
128+ esm.ubuntu.com:443
129+ github.com:443
130+ motd.ubuntu.com:443
131+ objects.githubusercontent.com:443
132+ packages.microsoft.com:443
133+
134+ - name : Checkout Repository
135+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
136+ with :
137+ persist-credentials : false
138+
139+ - name : Install dependencies (Windows)
140+ if : matrix.os == 'windows-latest'
141+ uses : lukka/get-cmake@2bcb1a4c14ab154443cc740dced0f9b6a8fb2b59 # v3.29.6
142+
143+ - name : Build
144+ id : build
145+ run : |
146+ mkdir build
147+ cd build
148+ cmake ..
149+ cmake --build . --config ${{ matrix.build_type }} -j 3 --verbose
150+
151+ - name : Run tests (Windows)
152+ if : ${{ matrix.os == 'windows-latest' && steps.build.outcome == 'success' }}
153+ run : |
154+ ./build/${{ matrix.build_type }}/Raven.exe
155+ ./build/${{ matrix.build_type }}/Raven.exe -v
156+ - name : Run tests (Ubuntu/macOS)
157+ if : ${{ matrix.os != 'windows-latest' && steps.build.outcome == 'success' }}
158+ run : |
159+ ./build/Raven
160+ ./build/Raven -v
0 commit comments