Skip to content

Commit 3964f37

Browse files
authored
Merge branch 'main' into dev_menaka
2 parents c6f2503 + 0cd8f50 commit 3964f37

File tree

101 files changed

+6366
-2554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+6366
-2554
lines changed

.github/workflows/codeql.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches:
17+
- "main"
18+
pull_request:
19+
branches:
20+
- "main"
21+
schedule:
22+
- cron: '0 9 1 * *' # At 09:00 AM, on day 1 of the month
23+
24+
jobs:
25+
analyze:
26+
name: Analyze (${{ matrix.language }})
27+
# Runner size impacts CodeQL analysis time. To learn more, please see:
28+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
29+
# - https://gh.io/supported-runners-and-hardware-resources
30+
# - https://gh.io/using-larger-runners (GitHub.com only)
31+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
32+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
33+
permissions:
34+
# required for all workflows
35+
security-events: write
36+
# required to fetch internal or private CodeQL packs
37+
packages: read
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- language: c-cpp
47+
build-mode: autobuild
48+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49+
# Use `c-cpp` to analyze code written in C, C++ or both
50+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56+
steps:
57+
- name: Harden Runner
58+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
59+
with:
60+
disable-sudo: false
61+
allowed-endpoints: >
62+
api.github.com:443
63+
github.com:443
64+
objects.githubusercontent.com:443
65+
66+
- name: Checkout repository
67+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
with:
69+
persist-credentials: false
70+
71+
# Add any setup steps before running the `github/codeql-action/init` action.
72+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
73+
# or others). This is typically only required for manual builds.
74+
# - name: Setup runtime (example)
75+
# uses: actions/setup-example@v1
76+
77+
# Initializes the CodeQL tools for scanning.
78+
- name: Initialize CodeQL
79+
uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
80+
with:
81+
languages: ${{ matrix.language }}
82+
build-mode: ${{ matrix.build-mode }}
83+
# If you wish to specify custom queries, you can do so here or in a config file.
84+
# By default, queries listed here will override any specified in a config file.
85+
# Prefix the list here with "+" to use these queries and those in the config file.
86+
87+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
88+
# queries: security-extended,security-and-quality
89+
90+
# If the analyze step fails for one of the languages you are analyzing with
91+
# "We were unable to automatically build your code", modify the matrix above
92+
# to set the build mode to "manual" for that language. Then modify this step
93+
# to build your code.
94+
# ℹ️ Command-line programs to run using the OS shell.
95+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
96+
- if: matrix.build-mode == 'manual'
97+
shell: bash
98+
run: |
99+
echo 'If you are using a "manual" build mode for one or more of the' \
100+
'languages you are analyzing, replace this with the commands to build' \
101+
'your code, for example:'
102+
echo ' make bootstrap'
103+
echo ' make release'
104+
exit 1
105+
106+
- name: Perform CodeQL Analysis
107+
uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
108+
with:
109+
category: "/language:${{matrix.language}}"

.github/workflows/first_pull_request.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Welcome
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/github-script@v6
13+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
1414
with:
1515
script: |
1616
// Get a list of all issues created by the PR opener
@@ -42,5 +42,9 @@ jobs:
4242
It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the \`AUTHORS.md\` and \`.zenodo.json\`:
4343
- [ ] The relevant author information has been added to \`AUTHORS.md\` and \`.zenodo.json\`
4444
45+
We also require that you sign our [Contributor License Agreement](https://github.com/CSHS-CWRA/RavenHydroFramework/blob/main/contributor-licensing-agreement.txt) before we can merge your code.
46+
Please add the following line to your Pull Request description:
47+
- [x] I have read and agree to the terms of the Contributor License Agreement.
48+
4549
Please make sure you've read our [contributing guide](CONTRIBUTING.md). We look forward to reviewing your Pull Request shortly ✨`
4650
})

.github/workflows/testing.yml

Lines changed: 130 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ Makefile
4141
# Runtime artifacts
4242
Raven
4343
Raven_errors.txt
44+
45+
# JetBrains
46+
.idea

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_language_version:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.5.0
6+
rev: v5.0.0
77
hooks:
88
- id: check-json
99
- id: pretty-format-json
@@ -26,7 +26,7 @@ repos:
2626
# - id: include-what-you-use
2727

2828
- repo: https://github.com/python-jsonschema/check-jsonschema
29-
rev: 0.28.1
29+
rev: 0.30.0
3030
hooks:
3131
- id: check-github-workflows
3232
- repo: meta

0 commit comments

Comments
 (0)