From 5bea6449f302c486ce1e84091ff4c7e6526c0221 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 2 Oct 2024 22:38:41 +0200 Subject: [PATCH] Add workflow to check the hardcoded fallback version in pyproject.toml against the version used in CI/run_reframe.sh and check against git tags listed --- .github/workflows/check_versions.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/check_versions.yml diff --git a/.github/workflows/check_versions.yml b/.github/workflows/check_versions.yml new file mode 100644 index 00000000..d3d22b5e --- /dev/null +++ b/.github/workflows/check_versions.yml @@ -0,0 +1,47 @@ +# 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[^"]+' "test-suite-$GITHUB_SHA/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]*' "test-suite-$GITHUB_SHA/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 +