Skip to content

Commit eb29a40

Browse files
authored
Adds testing for PRs (#212)
* Adds testing for PR, but skips release-related artifacts * add DT badge
1 parent dd6b7e1 commit eb29a40

4 files changed

Lines changed: 36 additions & 8 deletions

File tree

.github/workflows/daily-build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Read inputs
5656
id: getinputs
5757
run: |
58-
echo "INPUTS_IGNORE=${{ inputs.use_ignore }}" >> $GITHUB_OUTPUT
58+
echo "INPUTS_IGNORE=${{ inputs.use_ignore || 'check' }}" >> $GITHUB_OUTPUT
5959
6060
- run: echo "use_ignore is ${{ steps.getinputs.outputs.INPUTS_IGNORE }}."
6161

@@ -75,7 +75,7 @@ jobs:
7575
file_base: ${{ needs.call-workflow-tarball.outputs.file_base }}
7676
use_hdf: ${{ needs.get-old-names.outputs.hdf5-name }}
7777
use_environ: snapshots
78-
if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}
78+
if: ${{ (github.event_name != 'pull_request') && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}
7979

8080
call-workflow-ctest:
8181
needs: [get-old-names, call-workflow-tarball]
@@ -108,6 +108,7 @@ jobs:
108108
use_hdf: ${{ needs.get-old-names.outputs.hdf5-name }}
109109
file_base: ${{ needs.call-workflow-tarball.outputs.file_base }}
110110
use_environ: snapshots
111+
if: ${{ github.event_name != 'pull_request' }}
111112

112113
call-workflow-release:
113114
needs: [get-old-names, call-workflow-tarball, call-workflow-ctest]
@@ -120,7 +121,7 @@ jobs:
120121
file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }}
121122
use_tag: snapshot
122123
use_environ: snapshots
123-
if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}
124+
if: ${{ (github.event_name != 'pull_request') && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}
124125

125126
call-workflow-remove:
126127
needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-release]
@@ -131,7 +132,7 @@ jobs:
131132
file_base: ${{ needs.get-old-names.outputs.plugin-name }}
132133
use_tag: snapshot
133134
use_environ: snapshots
134-
if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) && (needs.get-old-names.outputs.hdf5-name != needs.call-workflow-tarball.outputs.file_base) }}
135+
if: ${{ (github.event_name != 'pull_request') && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) && (needs.get-old-names.outputs.hdf5-name != needs.call-workflow-tarball.outputs.file_base) }}
135136

136137
call-workflow-versions:
137138
uses: ./.github/workflows/check-releases.yml

.github/workflows/tarball.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
name: Check for recent commits
4545
runs-on: ubuntu-latest
4646
outputs:
47-
has_changes: ${{ steps.check-new-commits.outputs.has-new-commits }}
47+
has_changes: ${{ steps.check-new-commits.outputs.has-new-commits || steps.set-pr-commits.outputs.has-new-commits }}
4848
branch_ref: ${{ steps.get-branch-name.outputs.BRANCH_REF }}
4949
branch_sha: ${{ steps.get-branch-sha.outputs.BRANCH_SHA }}
5050
steps:
@@ -73,8 +73,14 @@ jobs:
7373
uses: adriangl/check-new-commits-action@v1
7474
with:
7575
seconds: 86400 # One day in seconds
76-
branch: '${{ steps.get-branch-name.outputs.branch_ref }}'
77-
if: ${{ (inputs.use_environ == 'snapshots' && inputs.use_ignore == 'check') }}
76+
branch: '${{ steps.get-branch-name.outputs.BRANCH_REF }}'
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
if: ${{ (inputs.use_environ == 'snapshots' && inputs.use_ignore == 'check' && github.event_name != 'pull_request') }}
79+
80+
- name: Set has-new-commits for pull requests
81+
id: set-pr-commits
82+
run: echo "has-new-commits=true" >> $GITHUB_OUTPUT
83+
if: ${{ github.event_name == 'pull_request' }}
7884

7985
- run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) in ${{ steps.get-branch-name.outputs.BRANCH_REF }} ✅!"
8086
if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }}
@@ -95,7 +101,7 @@ jobs:
95101
uses: actions/checkout@v4.1.7
96102
with:
97103
path: hdfsrc
98-
ref: '${{needs.check_commits.outputs.branch_ref }}'
104+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || needs.check_commits.outputs.branch_ref }}
99105

100106
- name: Retrieve version
101107
id: version

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Select HDF5 Filter Plugins Repository
22

3+
[![Daily Build](https://github.com/HDFGroup/hdf5_plugins/actions/workflows/daily-build.yml/badge.svg)](https://github.com/HDFGroup/hdf5_plugins/actions/workflows/daily-build.yml)
4+
35
This repository contains a select number of registered HDF5® filter plugins for use in HDF Group's development and testing activities of the HDF5® library. The HDF Group is the developer, maintainer, and steward of the HDF5® software. Find more
46
information about The HDF Group, the HDF5® Community, and other HDF5® software projects,
57
tools, and services at [The HDF Group's website](https://www.hdfgroup.org/).

config/cmake/binex/example/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ foreach (example ${dyn_examples} ${extra_examples})
6767
endforeach ()
6868

6969
if (H5PL_BUILD_TESTING)
70+
# Set plugin path relative to PROJECT_SOURCE_DIR
71+
# Windows: HDF5/HDFPLExamples/example -> ../../lib/plugin
72+
# Unix/Mac: HDF5/share/HDFPLExamples/example -> ../../../lib/plugin
73+
if (WIN32)
74+
set (PLUGIN_RELATIVE_PATH "../../lib/plugin")
75+
else ()
76+
set (PLUGIN_RELATIVE_PATH "../../../lib/plugin")
77+
endif ()
78+
7079
macro (ADD_H5_TEST testname)
7180
add_test (
7281
NAME ${testname}-clearall
@@ -102,6 +111,8 @@ if (H5PL_BUILD_TESTING)
102111
-D "TEST_ERRREF=1"
103112
-D "GREP_ERRREF=Filter present but encoding disabled"
104113
-D "TEST_LIBRARY_DIRECTORY=${TESTLIBDIR}"
114+
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
115+
-D "TEST_ENV_VALUE=${PROJECT_SOURCE_DIR}/${PLUGIN_RELATIVE_PATH}"
105116
-P "${H5PL_RESOURCES_DIR}/runTest.cmake"
106117
)
107118
set_tests_properties (${testname}-ERR PROPERTIES DEPENDS ${testname}-clearall)
@@ -123,6 +134,8 @@ if (H5PL_BUILD_TESTING)
123134
-D "TEST_OUTPUT=${testname}.out"
124135
-D "TEST_REFERENCE=${testname}.tst"
125136
-D "TEST_LIBRARY_DIRECTORY=${TESTLIBDIR}"
137+
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
138+
-D "TEST_ENV_VALUE=${PROJECT_SOURCE_DIR}/${PLUGIN_RELATIVE_PATH}"
126139
-P "${H5PL_RESOURCES_DIR}/runTest.cmake"
127140
)
128141
set_tests_properties (${testname} PROPERTIES DEPENDS ${testname}-clearall)
@@ -142,6 +155,8 @@ if (H5PL_BUILD_TESTING)
142155
-D "TEST_EXPECT=0"
143156
-D "TEST_REFERENCE=${testname}.ddl"
144157
-D "TEST_LIBRARY_DIRECTORY=${TESTLIBDIR}"
158+
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
159+
-D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/../plugins"
145160
-P "${H5PL_RESOURCES_DIR}/runTest.cmake"
146161
)
147162
else ()
@@ -158,6 +173,8 @@ if (H5PL_BUILD_TESTING)
158173
-D "TEST_EXPECT=0"
159174
-D "TEST_REFERENCE=${testname}.ddl"
160175
-D "TEST_LIBRARY_DIRECTORY=${TESTLIBDIR}"
176+
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
177+
-D "TEST_ENV_VALUE=${PROJECT_SOURCE_DIR}/${PLUGIN_RELATIVE_PATH}"
161178
-P "${H5PL_RESOURCES_DIR}/runTest.cmake"
162179
)
163180
else ()
@@ -174,6 +191,8 @@ if (H5PL_BUILD_TESTING)
174191
-D "TEST_MASK_MOD=1"
175192
-D "TEST_REFERENCE=${testname}.ddl"
176193
-D "TEST_LIBRARY_DIRECTORY=${TESTLIBDIR}"
194+
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
195+
-D "TEST_ENV_VALUE=${PROJECT_SOURCE_DIR}/${PLUGIN_RELATIVE_PATH}"
177196
-P "${H5PL_RESOURCES_DIR}/runTest.cmake"
178197
)
179198
endif ()

0 commit comments

Comments
 (0)