Skip to content

Commit a475a29

Browse files
authored
Merge branch 'main' into cleanup/readme-mention-acknowledgements
2 parents c26af38 + e325387 commit a475a29

91 files changed

Lines changed: 1485 additions & 807 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: 2024 Dennis Gläser <dennis.a.glaeser@gmail.com>
2+
# SPDX-License-Identifier: MIT
3+
4+
name: prepare-python-env
5+
runs:
6+
using: composite
7+
steps:
8+
- name: prepare-python-env
9+
run: |
10+
source /gfmt-venv/bin/activate
11+
echo "PATH=$PATH" >> $GITHUB_ENV
12+
shell: bash

.github/actions/set-git-variables/action.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ runs:
88
- name: set-git-variables
99
run: |
1010
if [[ ${{ github.event_name }} == "pull_request" ]]; then
11-
echo "GFMT_ORIGIN=${{ github.event.pull_request.head.repo.clone_url }}" >> "$GITHUB_ENV"
12-
echo "GFMT_TREE=${{ github.head_ref }}" >> "$GITHUB_ENV"
13-
echo "GFMT_SOURCE_TREE=origin/${{ github.head_ref }}" >> "$GITHUB_ENV"
11+
echo "GFMT_SOURCE_REMOTE=${{ github.event.pull_request.head.repo.clone_url }}" >> "$GITHUB_ENV"
12+
echo "GFMT_TARGET_REMOTE=${{ github.event.pull_request.base.repo.clone_url }}" >> "$GITHUB_ENV"
13+
echo "GFMT_SOURCE_TREE=${{ github.head_ref }}" >> "$GITHUB_ENV"
14+
echo "GFMT_TARGET_TREE=${{ github.base_ref }}" >> "$GITHUB_ENV"
1415
else
15-
echo "GFMT_ORIGIN=${{ github.event.repository.clone_url }}" >> "$GITHUB_ENV"
16-
echo "GFMT_TREE=${{ github.head_ref }}" >> "$GITHUB_ENV"
17-
if [[ -z "$GFMT_TREE" ]]; then
18-
echo "GFMT_TREE=${{ github.sha }}" >> "$GITHUB_ENV"
16+
echo "GFMT_SOURCE_REMOTE=${{ github.event.repository.clone_url }}" >> "$GITHUB_ENV"
17+
echo "GFMT_TARGET_REMOTE=${{ github.event.repository.clone_url }}" >> "$GITHUB_ENV"
18+
echo "GFMT_SOURCE_TREE=${{ github.head_ref }}" >> "$GITHUB_ENV"
19+
if [[ -z "${{github.head_ref}}" ]]; then
20+
echo "GFMT_SOURCE_TREE=${{ github.sha }}" >> "$GITHUB_ENV"
1921
fi
20-
echo "GFMT_SOURCE_TREE=${GFMT_TREE}" >> "$GITHUB_ENV"
22+
echo "GFMT_TARGET_TREE=main" >> "$GITHUB_ENV"
2123
fi
2224
shell: bash

.github/actions/set-test-commands/action.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ name: set-test-commands
55
inputs:
66
source_tree:
77
required: True
8+
source_remote:
9+
required: True
810
target_tree:
911
required: True
12+
target_remote:
13+
required: True
1014
build_directory:
1115
required: True
1216
runs:
@@ -18,28 +22,42 @@ runs:
1822
( ${{ github.ref_type }} == "tag" && ${{ github.ref_name }} =~ v[0-9]\.[0-9]\.[0-9]$ )]]; then
1923
echo "Using 'all' target on main branch (i.e. all tests are built & run)"
2024
echo "all" > _affected_tests.txt
25+
echo "GFMT_TEST_EXAMPLES=true" >> "$GITHUB_ENV"
2126
else
27+
echo "Regression-testing sample files only for branch ${{ github.ref_name }}"
28+
echo "GRIDFORMAT_REGRESSION_SAMPLES_ONLY=true" >> "$GITHUB_ENV"
29+
2230
pushd ${{inputs.build_directory}}
23-
echo "Detecting files that change from '${{inputs.source_tree}}' to '${{inputs.target_tree}}'"
24-
python3 ../bin/detect_modified_files.py -s "${{inputs.source_tree}}" -t "${{inputs.target_tree}}" &> _modfiles.out
31+
echo "Detecting files that change from '${{inputs.source_remote}}/${{inputs.source_tree}}' to '${{inputs.target_remote}}/${{inputs.target_tree}}'"
32+
python3 ../test/detect_modified_files.py \
33+
-sr "${{inputs.source_remote}}" \
34+
-s "${{inputs.source_tree}}" \
35+
-tr "${{inputs.target_remote}}" \
36+
-t "${{inputs.target_tree}}" \
37+
-o _modfiles.out
38+
39+
if cat _modfiles.out | grep 'examples/'; then
40+
echo "Including examples in tests"
41+
echo "GFMT_TEST_EXAMPLES=true" >> "$GITHUB_ENV"
42+
fi
2543
2644
echo "Detecting tests affected by these changes"
27-
python3 ../bin/detect_affected_tests.py -i _modfiles.out -o ../_affected_tests.txt
45+
python3 ../test/detect_affected_tests.py -i _modfiles.out -o ../_affected_tests.txt
2846
2947
echo "Generating list of all available targets"
3048
cmake --build . --target help &> ../all_targets.txt
3149
popd
3250
fi
3351
34-
BUILD_CMD=$(python3 bin/print_test_commands.py --build -f _affected_tests.txt)
52+
BUILD_CMD=$(python3 test/print_test_commands.py --build -f _affected_tests.txt)
3553
echo "Setting build command to ${BUILD_CMD}"
3654
echo "GFMT_BUILD_CMD=$BUILD_CMD" >> "$GITHUB_ENV"
3755
38-
TEST_CMD=$(python3 bin/print_test_commands.py --test -f _affected_tests.txt --ctest-args='--output-on-failure')
56+
TEST_CMD=$(python3 test/print_test_commands.py --test -f _affected_tests.txt --ctest-args='--output-on-failure')
3957
echo "Setting test command to ${TEST_CMD}"
4058
echo "GFMT_TEST_CMD=$TEST_CMD" >> "$GITHUB_ENV"
4159
42-
MEMCHECK_CMD=$(python3 bin/print_test_commands.py --build -f _affected_tests.txt --memcheck --all-targets-list all_targets.txt)
60+
MEMCHECK_CMD=$(python3 test/print_test_commands.py --build -f _affected_tests.txt --memcheck --all-targets-list all_targets.txt)
4361
echo "Setting memcheck command to ${MEMCHECK_CMD}"
4462
echo "GFMT_MEMCHECK_CMD=$MEMCHECK_CMD" >> "$GITHUB_ENV"
4563
shell: bash

.github/actions/test-installed-pkg/action.yml

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@ inputs:
77
required: true
88
cxx_compiler:
99
required: true
10+
allow_skipped_tests:
11+
required: true
1012
runs:
1113
using: composite
1214
steps:
1315
- name: remove-build-directory
1416
run: rm -rf build
1517
shell: bash
1618

19+
- name: prepare-python-env
20+
uses: ./.github/actions/prepare-python-env
21+
1722
- name: install-gridformat
1823
run: |
1924
cmake -DCMAKE_C_COMPILER=${{inputs.c_compiler}} \
2025
-DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}} \
26+
-DCMAKE_BUILD_TYPE=Release \
2127
-DGRIDFORMAT_BUILD_TESTS=ON \
2228
-DGRIDFORMAT_BUILD_BINARIES=ON \
2329
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
@@ -34,14 +40,18 @@ runs:
3440
uses: ./.github/actions/set-test-commands
3541
with:
3642
build_directory: build
43+
source_remote: ${{ env.GFMT_SOURCE_REMOTE }}
3744
source_tree: ${{ env.GFMT_SOURCE_TREE }}
38-
target_tree: main
45+
target_remote: ${{ env.GFMT_TARGET_REMOTE }}
46+
target_tree: ${{ env.GFMT_TARGET_TREE }}
3947

4048
- name: test-readme-cli-snippets
4149
run: |
42-
export PATH=$PATH:$(pwd)/install/bin
43-
python3 test/test_readme_cli_snippets.py \
44-
-c "-DCMAKE_C_COMPILER=${{inputs.c_compiler}} -DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}}"
50+
mkdir readme_snippet_test && pushd readme_snippet_test
51+
cp ../install/bin/* .
52+
export PATH=$PATH:$(pwd)
53+
python3 ../test/test_readme_cli_snippets.py \
54+
-c "-DCMAKE_C_COMPILER=${{inputs.c_compiler}} -DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}}"
4555
shell: bash
4656

4757
- name: test-installed-pkg
@@ -67,26 +77,48 @@ runs:
6777
popd
6878
shell: bash
6979

80+
- name: verify-no-skipped-tests
81+
run: |
82+
if [[ '${{ inputs.allow_skipped_tests }}' != 'true' ]]; then
83+
if [[ -e installation-test/build/Testing/Temporary/LastTestsDisabled.log ]]; then
84+
echo "The full test suite should not skip any tests. Making the job fail..."
85+
exit 1
86+
else
87+
echo "No skipped tests detected"
88+
fi
89+
else
90+
echo "Skipping verification that no tests have been skipped"
91+
fi
92+
shell: bash
93+
7094
- name: test-examples
7195
run: |
72-
pushd examples
73-
cmake -DCMAKE_C_COMPILER=${{inputs.c_compiler}} \
74-
-DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}} \
75-
-DCMAKE_PREFIX_PATH=/gfmt-dependencies \
76-
-Dgridformat_ROOT=$(pwd)/../install \
77-
-B build
78-
pushd build && make && ctest --output-on-failure
96+
if [[ '${{ env.GFMT_TEST_EXAMPLES }}' == 'true' ]]; then
97+
pushd examples
98+
cmake -DCMAKE_C_COMPILER=${{inputs.c_compiler}} \
99+
-DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}} \
100+
-DCMAKE_PREFIX_PATH=/gfmt-dependencies \
101+
-Dgridformat_ROOT=$(pwd)/../install \
102+
-B build
103+
pushd build && make && ctest --output-on-failure
104+
else
105+
echo "Skipping example testing"
106+
fi
79107
shell: bash
80108

81109
- name: test-examples-with-fetch-content
82110
run: |
83-
rm -rf examples/build && pushd examples
84-
cmake -DCMAKE_C_COMPILER=${{inputs.c_compiler}} \
85-
-DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}} \
86-
-DCMAKE_BUILD_TYPE=Release \
87-
-DCMAKE_PREFIX_PATH=/gfmt-dependencies \
88-
-DGRIDFORMAT_FETCH_TREE="$GFMT_TREE" \
89-
-DGRIDFORMAT_ORIGIN="$GFMT_ORIGIN" \
90-
-B build
91-
pushd build && make && ctest --output-on-failure
111+
if [[ '${{ env.GFMT_TEST_EXAMPLES }}' == 'true' ]]; then
112+
rm -rf examples/build && pushd examples
113+
cmake -DCMAKE_C_COMPILER=${{inputs.c_compiler}} \
114+
-DCMAKE_CXX_COMPILER=${{inputs.cxx_compiler}} \
115+
-DCMAKE_BUILD_TYPE=Release \
116+
-DCMAKE_PREFIX_PATH=/gfmt-dependencies \
117+
-DGRIDFORMAT_FETCH_TREE="$GFMT_SOURCE_TREE" \
118+
-DGRIDFORMAT_ORIGIN="$GFMT_SOURCE_REMOTE" \
119+
-B build
120+
pushd build && make && ctest --output-on-failure
121+
else
122+
echo "Skipping example testing"
123+
fi
92124
shell: bash

0 commit comments

Comments
 (0)