Test ifx #356
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: Test ifx | |
| on: | |
| # Trigger the workflow on push or pull request | |
| #push: | |
| pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! | |
| # Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. | |
| schedule: | |
| - cron: '0 18 2-31/2 * *' | |
| # Trigger the workflow manually | |
| workflow_dispatch: | |
| inputs: | |
| git-ref: | |
| description: Git Ref (Optional) | |
| required: false | |
| # Show the git ref in the workflow name if it is invoked manually. | |
| run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }} | |
| jobs: | |
| test: | |
| name: Run ifx tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Windows does not work. On Windows, the options for ifort/ifx starts with "/" instead of "-". | |
| # As of 202301, ifx is not available on macOS. | |
| os: [ubuntu-latest] | |
| fflags: [-O1, -O2, -O3, -g, -fast] | |
| testdim: [small, big] | |
| solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] | |
| steps: | |
| - name: Run `sudo apt update` | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: sudo apt update || true # Otherwise, free-disk-space or other actions relying on `apt` may fail | |
| - name: Free disk space | |
| if: startsWith(matrix.os, 'ubuntu') | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # all of these default to true, but feel free to set to "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: false # Important, or the runner may be shut down due to memory starvation. | |
| - name: Clone Repository (Latest) | |
| uses: actions/checkout@v6.0.2 | |
| if: github.event.inputs.git-ref == '' | |
| with: | |
| ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
| submodules: recursive | |
| - name: Clone Repository (Custom Ref) | |
| uses: actions/checkout@v6.0.2 | |
| if: github.event.inputs.git-ref != '' | |
| with: | |
| ref: ${{ github.event.inputs.git-ref }} | |
| ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
| submodules: recursive | |
| - name: Miscellaneous setup | |
| shell: bash | |
| run: bash .github/scripts/misc_setup | |
| - name: Install Intel oneAPI on Linux | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: bash .github/scripts/install_oneapi_linux.sh | |
| - name: Install Intel oneAPI on macOS | |
| if: startsWith(matrix.os, 'macos') | |
| run: bash .github/scripts/install_oneapi_macos.sh | |
| - name: Conduct the test; treat timeout as SUCCESS (exit 0) | |
| uses: equipez/run-bash-command@v2 | |
| with: | |
| timelimit: 320m | |
| command: | | |
| export FFLAGS=${{ matrix.fflags }} | |
| export TESTDIM=${{ matrix.testdim }} | |
| IK=i$(( 2**(1 + $(date +%-d) % 3) )) | |
| echo "IK=${IK}" | |
| echo "IK=${IK}" >> "$GITHUB_ENV" | |
| cd "$ROOT_DIR"/fortran/tests | |
| if [[ "${{ matrix.solver }}" == "cobyla" || "${{ matrix.testdim }}" == "big" ]]; then | |
| $SEDI 's|::[[:space:]]*NRAND_DFT[[:space:]]*=.*$|:: NRAND_DFT = 1|g' testsuite/param.f90 # Number of random tests when the dimension is small | |
| RP=r$(( 2**(2 + $(date +%-d) % 2) )) | |
| echo "RP=${RP}" | |
| TEST_SOLVERF90="test_cobyla.f90" | |
| if [[ "$RP" == "r8" && -f "$TEST_SOLVERF90" ]] ; then | |
| echo "Modifying $TEST_SOLVERF90 to skip the recursive tests." | |
| sed -i '/Test recursive call/,/^end module test_solver_mod/d' "$TEST_SOLVERF90" || exit 1 | |
| echo -e "end if\nend subroutine test_solver\nend module test_solver_mod" >> $TEST_SOLVERF90 | |
| echo "Done." | |
| cat "$TEST_SOLVERF90" | |
| fi | |
| make xtest_${IK}_${RP}_d1_tst.${{ matrix.solver }} | |
| else | |
| make xtest_${IK}.${{ matrix.solver }} | |
| fi | |
| cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} | |
| export EXAMPLE_NUM=1 && make clean && make xtest | |
| export EXAMPLE_NUM=2 && make clean && make xtest | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v7 | |
| if: always() # Always run even if the workflow is canceled manually or due to overtime. | |
| with: | |
| name: ${{ matrix.solver }}-${{ env.IK }}-${{ matrix.fflags }}-${{ matrix.testdim }} | |
| path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log | |
| - name: Remove the test data | |
| if: always() # Always run even if the workflow is canceled manually or due to overtime. | |
| run: rm -rf ${{ env.TEST_DIR }} |