Skip to content

Commit

Permalink
Merge branch 'main' into openfoam
Browse files Browse the repository at this point in the history
  • Loading branch information
Satish Kamath committed Dec 11, 2024
2 parents 59fcc3e + 061bfa1 commit 95d0551
Show file tree
Hide file tree
Showing 49 changed files with 195,159 additions and 165 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/automatic_versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: Test version for tarball without git metadata
on: [push, pull_request, workflow_dispatch]
permissions: read-all
jobs:
test_versioning_from_tarball:
# ubuntu <= 20.04 is required for python 3.6
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
steps:
# - name: Check out repository
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# with:
# persist-credentials: false
# fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: ${{ matrix.python-version }}

- name: Install setuptools
run: |
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
# system installed setuptools version in RHEL8 and CO7
python -m pip install --user setuptools==39.2.0
fi
- name: Install setuptools_scm
run: |
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
python -m pip install --user 'setuptools_scm>=4.0.0,<=4.1.2'
else
python -m pip install --user setuptools_scm
fi
- name: Check python and setuptools versions
run: |
python --version
python -m pip --version
python -c 'import setuptools; print("setuptools", setuptools.__version__)'
python -m pip show setuptools_scm | grep Version
- name: Download and extract tarball for current commit
run: |
wget "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/archive/$GITHUB_SHA.tar.gz"
tar -xzf "$GITHUB_SHA.tar.gz"
# Check current directory contents
find .
- name: Check version when running against uninstalled git clone
run: |
echo "importing eessi.testsuite from:"
original_pythonpath=$PYTHONPATH
export PYTHONPATH="$PWD/test-suite-$GITHUB_SHA:$PYTHONPATH"
echo "PYTHONPATH: $PYTHONPATH"
python3 -c "import eessi.testsuite; print(eessi.testsuite.__file__)"
uninstalled_version=$(python3 -c "import eessi.testsuite; print(eessi.testsuite.__version__)")
echo "Version from uninstalled git clone: $uninstalled_version"
fallback_version=$(grep -oP 'fallback_version\s*=\s*"\K[^"]+' "test-suite-$GITHUB_SHA/pyproject.toml")
echo "Testing if this version is the fallback version from pyproject.toml ..."
if [[ "$uninstalled_version" != "$fallback_version" ]]; then
echo "Version $uninstalled_version not equal to $fallback_version"
exit 1
else
echo "... yes!"
fi
export PYTHONPATH="$original_pythonpath"
- name: Install from extracted tarball
run: |
# Make sure we get the fallback version from the pyprject.toml before changing workdir
fallback_version=$(grep -oP 'fallback_version\s*=\s*"\K[^"]+' "test-suite-$GITHUB_SHA/pyproject.toml")
# Make it easier to figure out CI issues in case of CI failures related to SCM versioning
export SETUPTOOLS_SCM_DEBUG=1
# Change dir to the extracted tarball
cd "test-suite-$GITHUB_SHA"
python -m pip install . --user
echo "Checking contents of .local"
find $HOME/.local
# make sure we are not in the source directory
cd $HOME
echo "Checking if file 'eessi/testsuite/_version.py' was generated by setuptools_scm":
cat $HOME/.local/lib/python${{ matrix.python-version}}/site-packages/eessi/testsuite/_version.py
echo "Checking if version can be imported directly from the version file"
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
versionfile_version=$(python -c 'from eessi.testsuite._version import version; print(version)')
else
versionfile_version=$(python -c 'from eessi.testsuite._version import __version__; print(__version__)')
fi
echo "Version from version file: $versionfile_version"
echo "Checking if we can import the __version__ from eessi.testsuite"
installed_version=$(python -c 'import eessi.testsuite; print(eessi.testsuite.__version__)')
echo "Version from installed testsuite: $installed_version"
# Read the fallback version from the pyproject.toml
echo "Testing if this is the fallback version from pyproject.toml ..."
if [[ "$installed_version" != "$fallback_version" ]]; then
echo "Version $installed_version not equal to $fallback_version"
exit 1
else
echo "... yes!"
fi
echo "Checking if the version imported from eessi.testsuite matches that from the version file ..."
if [[ "$versionfile_version" != "$installed_version" ]]; then
echo "Version $versionfile_version not equal to $installed_version"
exit 1
else
echo "... yes!"
fi
47 changes: 47 additions & 0 deletions .github/workflows/check_versions.yml
Original file line number Diff line number Diff line change
@@ -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[^"]+' "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
86 changes: 86 additions & 0 deletions .github/workflows/pip_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
Expand All @@ -34,12 +35,18 @@ jobs:
- name: Install EESSI test suite with 'pip install'
run: |
# Make it easier to figure out CI issues in case of CI failures related to SCM versioning
export SETUPTOOLS_SCM_DEBUG=1
# install from source distribution tarball, to test release as published on PyPI
rm -rf dist
echo "Running python setup.py sdist"
python setup.py sdist
ls dist
echo "Running python -m pip install --user dist/eessi*.tar.gz"
python -m pip install --user dist/eessi*.tar.gz
echo "Checking contents of .local"
find $HOME/.local
# make sure we are not in the source directory
Expand All @@ -49,5 +56,84 @@ jobs:
python -m pip --version
python -c 'import setuptools; print("setuptools", setuptools.__version__)'
echo "Checking if file 'eessi/testsuite/_version.py' was generated by setuptools_scm":
cat $HOME/.local/lib/python${{ matrix.python-version}}/site-packages/eessi/testsuite/_version.py
echo "Checking if version can be imported directly from the version file"
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
versionfile_version=$(python -c 'from eessi.testsuite._version import version; print(version)')
else
versionfile_version=$(python -c 'from eessi.testsuite._version import __version__; print(__version__)')
fi
echo "Version from version file: $versionfile_version"
echo "Checking if we can import the __version__ from eessi.testsuite"
testsuite_version=$(python -c 'import eessi.testsuite; print(eessi.testsuite.__version__)')
echo "Version imported from eessi.testsuite: $testsuite_version"
echo "Checking if the version imported from eessi.testsuite matches that from the version file ..."
if [[ "$versionfile_version" != "$testsuite_version" ]]; then
echo "Version $versionfile_version not equal to $testsuite_version"
exit 1
else
echo "... yes!"
fi
echo "Checking if we can import eessi.testsuite.utils"
python -c 'import eessi.testsuite.utils'
echo "Checking if we can import eessi.testsuite.tests.apps"
python -c 'import eessi.testsuite.tests.apps'
- name: Install EESSI test suite with 'pip install git+https'
run: |
# Get version from the installation in the previous step
testsuite_version=$(python -c 'import eessi.testsuite; print(eessi.testsuite.__version__)')
# Cleanup installation from previous step
echo "Uninstalling testsuite for next step"
python -m pip uninstall -y eessi-testsuite
pip install --user "git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git@$GITHUB_SHA"
echo "Checking contents of .local"
find $HOME/.local
echo "Checking if file 'eessi/testsuite/_version.py' was generated by setuptools_scm":
cat $HOME/.local/lib/python${{ matrix.python-version}}/site-packages/eessi/testsuite/_version.py
echo "Checking if version can be imported directly from the version file"
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
githttps_versionfile_version=$(python -c 'from eessi.testsuite._version import version; print(version)')
else
githttps_versionfile_version=$(python -c 'from eessi.testsuite._version import __version__; print(__version__)')
fi
echo "Version from version file: $githttps_versionfile_version"
echo "Checking if we can import the __version__ from eessi.testsuite"
githttps_testsuite_version=$(python -c 'import eessi.testsuite; print(eessi.testsuite.__version__)')
echo "Version imported from eessi.testsuite: $githttps_testsuite_version"
echo "Checking if the version imported from eessi.testsuite matches that from the version file ..."
if [[ "$githttps_versionfile_version" != "$githttps_testsuite_version" ]]; then
echo "Version $githttps_versionfile_version not equal to $githttps_testsuite_version"
exit 1
else
echo "... yes!"
fi
echo "Checking if the version import from a regular pip install and the git+https based install are the same ..."
if [[ "$githttps_testsuite_version" != "$testsuite_version" ]]; then
echo "Version $githttps_testsuite_version not equal to $testsuite_version"
exit 1
else
echo "... yes!"
fi
echo "Checking if we can import eessi.testsuite.utils"
python -c 'import eessi.testsuite.utils'
echo "Checking if we can import eessi.testsuite.tests.apps"
python -c 'import eessi.testsuite.tests.apps'
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
# update $PYTHONPATH so 'import eessi.testsuite.utils' works
export PYTHONPATH=$PWD:$PYTHONPATH
echo $PYTHONPATH
python -c 'import eessi.testsuite.utils'
# show active ReFrame configuration,
# enable verbose output to help expose problems with configuration file (if any)
Expand Down
1 change: 1 addition & 0 deletions CI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ It should define:
- `RFM_CHECK_SEARCH_PATH` (optional): the search path where ReFrame should search for tests to run in this CI pipeline. Default: `${TEMPDIR}/test-suite/eessi/testsuite/tests/`.
- `RFM_CHECK_SEARCH_RECURSIVE` (optional): whether ReFrame should search `RFM_CHECK_SEARCH_PATH` recursively. Default: `1`.
- `RFM_PREFIX` (optional): the prefix in which ReFrame stores all the files. Default: `${HOME}/reframe_CI_runs`.
- `REFRAME_TIMEOUT` (optional): DURATION as passed to the `timeout` command in Unix. If the `reframe` commands runs for longer than this, it will be killed by SIGTERM. The ReFrame runtime will then cancel all scheduled (and running) jobs. Can be used to make sure jobs don't pile up, e.g. if the test suite runs daily, but it takes longer than one day to process all jobs.

## Creating the `crontab` entry and specifying `EESSI_CI_SYSTEM_NAME`
This line depends on how often you want to run the tests, and where the `run_reframe_wrapper.sh` is located exactly. We also define the EESSI_CI_SYSTEM_NAME in this entry, as cronjobs don't normally read your `.bashrc` (and thus we need a different way of specifying this environment variable).
Expand Down
4 changes: 4 additions & 0 deletions CI/azure_mc/ci_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Configurable items
if [ -z "${REFRAME_ARGS}" ]; then
REFRAME_ARGS="--tag CI --tag 1_node"
fi
21 changes: 15 additions & 6 deletions CI/run_reframe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ -z "${REFRAME_ARGS}" ]; then
REFRAME_ARGS="--tag CI --tag 1_node"
fi
if [ -z "${REFRAME_VERSION}"]; then
REFRAME_VERSION=4.5.1
REFRAME_VERSION=4.6.2
fi
if [ -z "${REFRAME_URL}" ]; then
REFRAME_URL='https://github.com/reframe-hpc/reframe.git'
Expand All @@ -48,7 +48,7 @@ if [ -z "${EESSI_TESTSUITE_URL}" ]; then
EESSI_TESTSUITE_URL='https://github.com/EESSI/test-suite.git'
fi
if [ -z "${EESSI_TESTSUITE_BRANCH}" ]; then
EESSI_TESTSUITE_BRANCH='v0.3.2'
EESSI_TESTSUITE_BRANCH='v0.4.0'
fi
if [ -z "${EESSI_CVMFS_REPO}" ]; then
export EESSI_CVMFS_REPO=/cvmfs/software.eessi.io
Expand All @@ -68,6 +68,11 @@ fi
if [ -z "${RFM_PREFIX}" ]; then
export RFM_PREFIX="${HOME}/reframe_CI_runs"
fi
if [ -z "${REFRAME_TIMEOUT}" ]; then
# 10 minutes short of 1 day, since typically the test suite will be run daily.
# This will prevent multiple ReFrame runs from piling up and exceeding the quota on our Magic Castle clusters
export REFRAME_TIMEOUT=1430m
fi

# Create virtualenv for ReFrame using system python
python3 -m venv "${TEMPDIR}"/reframe_venv
Expand All @@ -76,11 +81,15 @@ python3 -m pip install --upgrade pip
python3 -m pip install reframe-hpc=="${REFRAME_VERSION}"

# Clone reframe repo to have the hpctestlib:
git clone "${REFRAME_URL}" --branch "${REFRAME_BRANCH}" "${TEMPDIR}"/reframe
REFRAME_CLONE_ARGS="${REFRAME_URL} --branch ${REFRAME_BRANCH} ${TEMPDIR}/reframe"
echo "Cloning ReFrame repo: git clone ${REFRAME_CLONE_ARGS}"
git clone ${REFRAME_CLONE_ARGS}
export PYTHONPATH="${PYTHONPATH}":"${TEMPDIR}"/reframe

# Clone test suite repo
git clone "${EESSI_TESTSUITE_URL}" --branch "${EESSI_TESTSUITE_BRANCH}" "${TEMPDIR}"/test-suite
EESSI_CLONE_ARGS="${EESSI_TESTSUITE_URL} --branch ${EESSI_TESTSUITE_BRANCH} ${TEMPDIR}/test-suite"
echo "Cloning EESSI repo: git clone ${EESSI_CLONE_ARGS}"
git clone ${EESSI_CLONE_ARGS}
export PYTHONPATH="${PYTHONPATH}":"${TEMPDIR}"/test-suite/

# Start the EESSI environment
Expand All @@ -100,7 +109,7 @@ echo ""
echo "TEMPDIR: ${TEMPDIR}"
echo "PYTHONPATH: ${PYTHONPATH}"
echo "EESSI test suite URL: ${EESSI_TESTSUITE_URL}"
echo "EESSI test suite version: ${EESSI_TESTSUITE_VERSION}"
echo "EESSI test suite version: ${EESSI_TESTSUITE_BRANCH}"
echo "HPCtestlib from ReFrame URL: ${REFRAME_URL}"
echo "HPCtestlib from ReFrame branch: ${REFRAME_BRANCH}"
echo "ReFrame executable: $(which reframe)"
Expand All @@ -118,7 +127,7 @@ reframe ${REFRAME_ARGS} --list

# Run
echo "Run tests:"
reframe ${REFRAME_ARGS} --run
timeout -v --preserve-status -s SIGTERM ${REFRAME_TIMEOUT} reframe ${REFRAME_ARGS} --run

# Cleanup
rm -rf "${TEMPDIR}"
Loading

0 comments on commit 95d0551

Please sign in to comment.