Skip to content

Commit b7c4421

Browse files
committed
Use scripts/check-version.sh to produce reference test files for new tags
1 parent 0c3b345 commit b7c4421

File tree

3 files changed

+67
-91
lines changed

3 files changed

+67
-91
lines changed

contributing.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ In general you should always perform the following steps when contributing.
2222
We ask that you put some effort into the readability of your code.
2323
We are, however, always happy to help if there is an issue.
2424

25-
We use linting as part of our ci/cd for the python code.
25+
We use linting as part of our ci/cd for the python code.
2626
That means your code will be checked automatically, and you must make sure it conforms to certain rules.
2727

2828
Currently no linting or automatic checks of C++ code are implemented.
2929
Although we do not have a well-defined style guide for C++, we always appreciate readable and well-formatted code.
3030

3131
### Technical details on linting
3232

33-
we use `flake8` and `black` for linting.
33+
we use `flake8` and `black` for linting.
3434
To run the linting locally before making your pull request, or before making a commit, you can do the following.
3535

36-
ensure `flake8` and `black` are installed:
36+
ensure `flake8` and `black` are installed:
3737

3838
```
3939
python -m pip install -q flake8 black
@@ -64,7 +64,7 @@ For that reason, whenever you make a change you should consider whether this req
6464

6565
If the change is user-facing it almost certainly does require a documentation update.
6666

67-
Documentation is **very important** to us.
67+
Documentation is **very important** to us.
6868
Therefore, we will be meticulous and make sure it is done well!
6969
However, we don't want to put extra burden on you, so we are happy to help and will make our own edits and updates to improve the documentation of your change.
7070

@@ -105,32 +105,32 @@ mike deploy <version> <alias>
105105

106106
Note that this will only affect your *local* copy of the gh-pages documentation. In order to view the pages locally you can use `mike serve` instead of `mkdocs serve`.
107107

108-
**NOTE:** mkdocs builds that use internal links (or images, etc.) with absolute paths will work for local deployment, but will break when deployed to the public documentations pages.
109-
Please ensure you use relative paths. Currently, this is the only known feature where the behvaiour differs between local mkdocs and public page deployment.
108+
**NOTE:** mkdocs builds that use internal links (or images, etc.) with absolute paths will work for local deployment, but will break when deployed to the public documentations pages.
109+
Please ensure you use relative paths. Currently, this is the only known feature where the behvaiour differs between local mkdocs and public page deployment.
110110
If you'd like to test the deployment directly, the suggested method is to set up a docs page using your personal github account; this should mimic the exact settings of the official page.
111111

112-
## Github Actions
112+
## Github Actions
113113

114-
There are several automated processes defined in the [`.github/workflows`](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/tree/main/.github/workflows) folder which are triggered for every pull request or when a new commit is pushed into the `main` branch.
114+
There are several automated processes defined in the [`.github/workflows`](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/tree/main/.github/workflows) folder which are triggered for every pull request or when a new commit is pushed into the `main` branch.
115115

116-
- `CI with CVMFS` workflow defined in [.github/workflows/cvmfs-ci.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/cvmfs-ci.yml) compiles <span style="font-variant:small-caps;">Combine</span> with the CMSSW which is setup from `cvmfs`. This will also run several test <span style="font-variant:small-caps;">Combine</span> commands using tutorial datacards contained in the repository.
116+
- `CI with CVMFS` workflow defined in [.github/workflows/cvmfs-ci.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/cvmfs-ci.yml) compiles <span style="font-variant:small-caps;">Combine</span> with the CMSSW which is setup from `cvmfs`. This will also run several test <span style="font-variant:small-caps;">Combine</span> commands using tutorial datacards contained in the repository.
117117
- `CI/CD` workflow defined in [.github/workflows/ci.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/ci.yml) runs:
118-
118+
119119
1. [Linting checks](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/ci.yml#L11) with`flake8` and `black`.
120-
2. <span style="font-variant:small-caps;">Combine</span> compilation using conda environment with several combinations of (ROOT, python) versions: (6.26.4, 3.10), (6.24,3.9), (6.22, 3.9) and (6.22, 2.7.18)
121-
120+
2. <span style="font-variant:small-caps;">Combine</span> compilation using conda environment with several combinations of (ROOT, python) versions: (6.26.4, 3.10), (6.24,3.9), (6.22, 3.9) and (6.22, 2.7.18)
121+
122122
- `Docs` workflow defined in [.github/workflows/docs.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/docs.yml) manages the documentation deployment with `mike` as described above.
123123

124-
In addition there are two conditional workflows that can be triggered with [github labels](https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels):
124+
In addition there are two conditional workflows that can be triggered with [github labels](https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels):
125125

126-
- `trigger gitlab job` workflow defined in [.github/workflows/gitlabci.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/gitlabci.yml) can be triggered with the "safe to test" label. Please note that this gitlab workflow uses `CMSSW_10_2_13`, therefore it might fail with later versions of <span style="font-variant:small-caps;">Combine</span> and it is likely to be deprecated soon.
126+
- `trigger gitlab job` workflow defined in [.github/workflows/gitlabci.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/gitlabci.yml) can be triggered with the "safe to test" label. Please note that this gitlab workflow uses `CMSSW_10_2_13`, therefore it might fail with later versions of <span style="font-variant:small-caps;">Combine</span> and it is likely to be deprecated soon.
127127

128-
- `Port to <branch>` workflows defined in [.github/workflows/port_to_branch.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/port_to_branch.yml), e.g. the `Port to 112x-comb2022` can be triggered with the "port to 112x-comb2022" label to port the changes from a pull request to the `112x-comb2022` branch and create a new pull request.
128+
- `Port to <branch>` workflows defined in [.github/workflows/port_to_branch.yml](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/blob/main/.github/workflows/port_to_branch.yml), e.g. the `Port to 112x-comb2022` can be triggered with the "port to 112x-comb2022" label to port the changes from a pull request to the `112x-comb2022` branch and create a new pull request.
129129

130130

131131
## Big Contributions
132132

133-
We welcome large contributions to <span style="font-variant:small-caps;">Combine</span>.
133+
We welcome large contributions to <span style="font-variant:small-caps;">Combine</span>.
134134
Note, however, that we also follow long term planning, and there is a dedicated group stewarding the overall direction and development of the code.
135135

136136
This means that the code development should fit in with our long term vision;
@@ -161,8 +161,13 @@ When creating a new release, follow this checklist to ensure version strings are
161161
- Update the release notes link on line 40
162162

163163
3. **Update test reference files**
164-
- Run: `./test/references/update-version.sh vX.Y.Z`
165-
- This updates version strings in all test output reference files
164+
- Regenerate reference files with the new version (note that you will have to recompile using `-DBUILD_TESTS=TRUE`):
165+
```bash
166+
cd build/test
167+
sh create_reference_files.sh
168+
cp *.out ../../test/references
169+
cd ../..
170+
```
166171

167172
4. **Verify version consistency**
168173
- Run the version check script: `./scripts/check-version.sh vX.Y.Z`

scripts/check-version.sh

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,56 @@ else
9797
echo " This is expected if the release hasn't been created yet"
9898
fi
9999

100+
# Check 5: test/references/*.out - version in test reference files
101+
echo -n "Checking test/references/*.out (test reference files)... "
102+
TEST_REF_DIR="$REPO_ROOT/test/references"
103+
if [ ! -d "$TEST_REF_DIR" ]; then
104+
echo -e "${YELLOW}SKIP${NC}"
105+
echo " Directory not found: $TEST_REF_DIR"
106+
else
107+
# Count how many .out files exist
108+
OUT_FILES=("$TEST_REF_DIR"/*.out)
109+
if [ ! -e "${OUT_FILES[0]}" ]; then
110+
echo -e "${YELLOW}SKIP${NC}"
111+
echo " No .out files found in $TEST_REF_DIR"
112+
else
113+
# Check files that contain version pattern
114+
# Only check files that have "<<< v" pattern (some files like text2workspace output don't have it)
115+
WRONG_VERSION_FILES=()
116+
for file in "$TEST_REF_DIR"/*.out; do
117+
if [ -f "$file" ]; then
118+
# Check if file contains any version pattern
119+
if grep -q "<<< v" "$file"; then
120+
# This file should have a version, check if it's the correct one
121+
if ! grep -q "<<< ${VERSION} >>>" "$file"; then
122+
FOUND=$(grep "<<< v" "$file" | head -1 | sed -E 's/.*<<< (v[0-9.]+) >>>.*/\1/' || echo "unknown")
123+
WRONG_VERSION_FILES+=("$(basename "$file") (found: $FOUND)")
124+
fi
125+
fi
126+
fi
127+
done
128+
129+
if [ ${#WRONG_VERSION_FILES[@]} -eq 0 ]; then
130+
echo -e "${GREEN}OK${NC}"
131+
else
132+
echo -e "${RED}FAIL${NC}"
133+
echo " The following files don't contain '<<< ${VERSION} >>>':"
134+
for file_info in "${WRONG_VERSION_FILES[@]}"; do
135+
echo " - $file_info"
136+
done
137+
echo " Run: cd build/test && sh create_reference_files.sh && cp *.out ../../test/references"
138+
ERRORS=$((ERRORS + 1))
139+
fi
140+
fi
141+
fi
142+
100143
echo ""
101144
if [ $ERRORS -eq 0 ]; then
102145
echo -e "${GREEN}✓ All version checks passed!${NC}"
103146
echo ""
104147
echo "Next steps:"
105148
echo " 1. Commit the version updates:"
106-
echo " git add bin/combine.cpp docs/index.md"
149+
echo " git add bin/combine.cpp docs/index.md test/references/*.out"
107150
echo " git commit -m \"Update version to ${VERSION}\""
108151
echo " 2. Create and push the tag:"
109152
echo " git tag -a ${VERSION} -m \"Release ${VERSION}\""

test/references/update-version.sh

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)