mcstas-conda-testsuite #303
This file contains hidden or 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: mcstas-conda-testsuite | |
| on: | |
| schedule: | |
| - cron: '00 02 * * *' # 02:00 every day | |
| workflow_dispatch: | |
| inputs: | |
| manual-debugging: | |
| type: boolean | |
| description: Launch manual debugging tmate for inspection (automatic in case of errors) | |
| default: false | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, mpi: 'openmpi' } | |
| - { os: macos-latest, mpi: 'openmpi' } | |
| - { os: windows-latest, mpi: 'msmpi' } | |
| name: ${{ matrix.os }}.${{ matrix.mpi }}.conda-testsuite | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| path: src | |
| - name: Setup VS in shell Intel | |
| if: runner.os == 'Windows' | |
| uses: egor-tensin/vs-shell@v2 | |
| - name: Get conda dependency list | |
| id: conda-deps | |
| run: | | |
| ./src/devel/bin/mccode-create-conda-yml -m mcstas -n mcstas -o dependencies.yml | |
| cat dependencies.yml | |
| - uses: mamba-org/setup-micromamba@v3 | |
| with: | |
| environment-name: mcstas | |
| environment-file: dependencies.yml | |
| - name: Check versions | |
| id: version-checks | |
| run: | | |
| which python3 | |
| python3 --version | |
| which cmake | |
| cmake --version | |
| - name: Configure build and install mcstas | |
| id: mcstas-install | |
| run: | | |
| ./src/devel/bin/mccode-build-conda -m mcstas -s $PWD/src -b $PWD/build_mcstas | |
| - name: Validate build output | |
| id: build-validation | |
| if: always() | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| echo "Validating Windows build output..." | |
| echo "CONDA_PREFIX: $CONDA_PREFIX" | |
| echo "Checking for mcstas executable..." | |
| test -f ${CONDA_PREFIX}/bin/mcstas || test -f ${CONDA_PREFIX}/bin/mcstas.bat || { echo "ERROR: mcstas not found"; exit 1; } | |
| echo "Checking for mctest executable..." | |
| test -f ${CONDA_PREFIX}/bin/mctest.bat || { echo "ERROR: mctest.bat not found"; ls -la ${CONDA_PREFIX}/bin/ | grep -i mctest || echo "No mctest found"; exit 1; } | |
| else | |
| echo "Validating Unix build output..." | |
| test -f ${CONDA_PREFIX}/bin/mcstas || { echo "ERROR: mcstas not found"; exit 1; } | |
| test -f ${CONDA_PREFIX}/bin/mctest || { echo "ERROR: mctest not found"; exit 1; } | |
| fi | |
| - name: Post install openmpi hacks macOS | |
| id: post-install-openmpi-hacks-macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| if [ "${{ matrix.mpi }}" == "openmpi" ]; then | |
| sed -i.bak 's+mpirun+mpirun\ -mca\ regx\ naive\ --verbose\ --mca\ btl_tcp_if_include\ lo0+g' ${CONDA_PREFIX}/share/mcstas/tools/Python/mccodelib/mccode_config.json | |
| fi | |
| - name: Test suite, up to 2-core MPI | |
| id: test-suite | |
| run: | | |
| # Create and cd to directory for test output data | |
| mkdir run_test-suite && cd run_test-suite | |
| # Test script name | |
| export MCTEST_EXECUTABLE="mctest" | |
| if [ "$RUNNER_OS" == "Windows" ]; | |
| then | |
| export MCTEST_EXECUTABLE="mctest.bat" | |
| fi | |
| # Workaround for warning about "too long" tmpdir name on macOS/openmpi | |
| if [ "$RUNNER_OS" == "macOS" ]; | |
| then | |
| mkdir ${HOME}/tmp | |
| export TMPDIR=${HOME}/tmp | |
| fi | |
| # Run the test with 2 core mpi | |
| ${MCTEST_EXECUTABLE} --verbose --testdir $PWD --suffix ${{ matrix.os }}_${{ matrix.mpi }} --mpi=2 | |
| - name: 'Tar output files' | |
| id: tar-package | |
| if: always() | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| # Clear out binaries from sim dir and tar up artifact | |
| ls | grep run_ | xargs -n1 ./src/devel/bin/mccode-simdir-cleanfiles -d | |
| tar cvfz mcstas-${{ matrix.os }}.${{ matrix.mpi }}.conda-testsuite_output.tgz run_test-suite | |
| - name: 'Upload Artifact' | |
| id: tar-upload | |
| uses: actions/upload-artifact@v6 | |
| if: always() | |
| with: | |
| name: mcstas-artefacts-${{ matrix.os }}.${{ matrix.mpi }}.conda-testsuite | |
| path: "mcstas-${{ matrix.os }}.${{ matrix.mpi }}.conda-testsuite_output.tgz" | |
| - name: Setup tmate session for manual debugging | |
| uses: mxschmitt/action-tmate@v3 | |
| if: always() && (inputs.manual-debugging == true) | |
| with: | |
| limit-access-to-actor: true |