Use extractall so that no error is raised if the pattern is not found… #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
name: Test fallback_version and version in run_reframe.sh against tags | |
on: [push, pull_request, workflow_dispatch] | |
permissions: read-all | |
jobs: | |
test_fallback_version_against_tags: | |
# ubuntu <= 20.04 is required for python 3.6 | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Check fallback version and version used in run_reframe.sh | |
run: | | |
# Get fallback version | |
fallback_version=$(grep -oP 'fallback_version\s*=\s*"\K[^"]+' "pyproject.toml") | |
# Prepend fallback version with 'v', as that is also the case for the other two version strings | |
fallback_version="v$fallback_version" | |
# Get version from run_reframe.sh | |
run_reframe_testsuite_version=$(grep -oP 'EESSI_TESTSUITE_BRANCH\s*=\s*[^v]*\K[^"\x27]*' "CI/run_reframe.sh") | |
# Grab the tag for the highest version, by sorting by (semantic) version, and then filtering on patterns | |
# that match a pattern like v0.1.2. Finally, we grab the last to get the highest version | |
most_recent_version=$(git tag --sort=version:refname | grep -P "v[0-9]+\.[0-9]+\.[0-9]+" | tail -n 1) | |
echo "Testing if fallback version and EESSI_TESTSUITE_BRANCH version in CI/run_reframe.sh are the same" | |
if [[ "$fallback_version" != "$run_reframe_testsuite_version" ]]; then | |
echo "Version $fallback_version not equal to $run_reframe_testsuite_version" | |
exit 1 | |
else | |
echo "... yes!" | |
fi | |
echo "Testing if fallback version and most recent version tag are the same" | |
if [[ "$fallback_version" != "$most_recent_version" ]]; then | |
echo "Version $fallback_version not equal to $most_recent_version" | |
exit 1 | |
else | |
echo "... yes!" | |
fi | |