Nosetests and Valgrind #130
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
name: Nosetests and Valgrind | |
on: | |
schedule: | |
- cron: '0 17 * * *' # Daily at UTC 17:00 | |
jobs: | |
iftest: | |
runs-on: [self-hosted, linux] | |
outputs: | |
should_run: ${{ steps.store_output.outputs.SHOULD_RUN }} | |
steps: | |
- name: Store output | |
id: store_output | |
env: | |
SHA_LAST_SUCCESS: ${{ secrets.SHA_LAST_SUCCESS }} | |
run: | | |
if [ "$SHA_LAST_SUCCESS" != "${{ github.sha }}" ]; then | |
echo "SHOULD_RUN=1" >> "$GITHUB_OUTPUT" | |
fi | |
conclude: | |
runs-on: [self-hosted, linux] | |
needs: [nose_tests_lvl3, valgrind-wide-and-shallow, valgrind-narrow-and-deep] | |
steps: | |
- name: Store current SHA as secret | |
uses: hmanzur/[email protected] | |
with: | |
name: 'SHA_LAST_SUCCESS' | |
value: ${{ github.sha }} | |
repository: AarhusCosmology/CLASSpp | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
- name: Checkout master ποΈ | |
uses: actions/checkout@v4 | |
with: | |
path: main_class | |
ref: master | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Push to public master | |
env: | |
TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
run: | | |
cd main_class | |
git push https://AarhusCosmology:"$TOKEN"@github.com/AarhusCosmology/CLASSpp_public master:master | |
nose_tests_lvl3: | |
runs-on: [self-hosted, linux, heavy] | |
needs: iftest | |
if: needs.iftest.outputs.should_run | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
with: | |
path: main_class | |
- name: Create virtual Python environment | |
run: | | |
rm -rf venv | |
DEB_PYTHON_INSTALL_LAYOUT='deb' virtualenv venv --system-site-packages | |
source venv/bin/activate | |
pip install --upgrade setuptools | |
deactivate | |
- name: make | |
run: source venv/bin/activate && cd main_class && pip install . && deactivate | |
- name: Testing π€ | |
run: | | |
source venv/bin/activate | |
cd main_class/python | |
COMPARE_OUTPUT_GAUGE=1 TEST_LEVEL=3 python "$(which nosetests)" -v -a test_scenario test_class.py | |
deactivate | |
- name: Upload plots π€ | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ComparePlots | |
path: main_class/python/faulty_figs | |
- name: Remove virtual Python environment | |
if: success() || failure() | |
run: rm -rf venv | |
valgrind-wide-and-shallow: | |
runs-on: [self-hosted, linux, heavy] | |
needs: iftest | |
if: needs.iftest.outputs.should_run | |
timeout-minutes: 1440 | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
with: | |
path: main_class | |
- name: Create virtual Python environment | |
run: | | |
rm -rf venv | |
DEB_PYTHON_INSTALL_LAYOUT='deb' virtualenv venv --system-site-packages | |
source venv/bin/activate | |
pip install --upgrade setuptools | |
deactivate | |
- name: make | |
run: source venv/bin/activate && cd main_class && make class -j && pip install . && deactivate | |
- name: Generate input files | |
run: | | |
source venv/bin/activate | |
cd main_class/python | |
TEST_LEVEL=3 CLASS_VERBOSE=1 python "$(which nosetests)" -a dump_ini_files test_class.py | |
deactivate | |
- name: Remove virtual Python environment | |
if: success() || failure() | |
run: rm -rf venv | |
- name: Valgrind π€ | |
run: | | |
cd main_class/python/faulty_figs | |
rm -rf output && mkdir output | |
rm -rf valgrind_output && mkdir valgrind_output | |
cp ../../class . | |
find . -name "*.ini" -type f -print0 | xargs -0 -I {} -n 1 -P 6 bash -c ': \ | |
&& printf "\nk_step_sub = 10.0\nk_step_super = 0.4\nk_per_decade_for_pk = 2\nk_per_decade_for_bao = 5\n" >> {}' | |
find . -name "*.ini" -type f -print0 | xargs -0 -I {} -n 1 -P 6 bash -c ': \ | |
&& (valgrind --leak-check=full --error-exitcode=3 ./class {} &> {}.out && echo {} "...ok") \ | |
|| (echo {} "...fail" && cp {}* valgrind_output && exit 3)' | |
- name: Upload errors π€ | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ValgrindOutputWideShallow | |
path: main_class/python/faulty_figs/valgrind_output | |
valgrind-narrow-and-deep: | |
runs-on: [self-hosted, linux, heavy] | |
needs: iftest | |
if: needs.iftest.outputs.should_run | |
timeout-minutes: 1440 | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
with: | |
path: main_class | |
- name: Create virtual Python environment | |
run: | | |
rm -rf venv | |
DEB_PYTHON_INSTALL_LAYOUT='deb' virtualenv venv --system-site-packages | |
source venv/bin/activate | |
pip install --upgrade setuptools | |
deactivate | |
- name: make | |
run: source venv/bin/activate && cd main_class && make class -j && pip install . && deactivate | |
- name: Generate input files | |
run: | | |
source venv/bin/activate | |
cd main_class/python | |
TEST_LEVEL=1 CLASS_VERBOSE=1 python "$(which nosetests)" -a dump_ini_files test_class.py | |
deactivate | |
- name: Remove virtual Python environment | |
if: success() || failure() | |
run: rm -rf venv | |
- name: Valgrind π€ | |
run: | | |
cd main_class/python/faulty_figs | |
rm -rf output && mkdir output | |
rm -rf valgrind_output && mkdir valgrind_output | |
cp ../../class . | |
find . -name "*.ini" -type f -print0 | xargs -0 -I {} -n 1 -P 6 bash -c ': \ | |
&& (valgrind --leak-check=full --error-exitcode=3 ./class {} &> {}.out && echo {} "...ok") \ | |
|| (echo {} "...fail" && cp {}* valgrind_output && exit 3)' | |
- name: Upload errors π€ | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ValgrindOutputNarrowDeep | |
path: main_class/python/faulty_figs/valgrind_output |