Test Flang #181
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: Test Flang | |
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 4 2-31/3 * *' | |
# Trigger the workflow manually | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref (Optional) | |
required: false | |
maxtr: | |
description: Maximum number of trust-region iterations | |
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}, maxtr {1}', inputs.git-ref, inputs.maxtr) || '' }} | |
jobs: | |
test: | |
name: Run Flang tests | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] # As of 20240421, the flang installed by ../scripts/install_flang may only work with ubuntu-22.04 | |
ikind: [i2, i4, i8] | |
solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa] | |
fflags: [-O1, -O2, -O3, -g, -fast] | |
testdim: [small, big] | |
steps: | |
- name: Clone Repository (Latest) | |
uses: actions/checkout@v4 | |
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@v4 | |
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: Install Flang | |
run: bash .github/scripts/install_flang | |
- name: Miscellaneous setup | |
run: bash .github/scripts/misc_setup | |
- name: Revise maxtr | |
# This is to see whether "GitHub Actions xx lost communication with the server" was caused | |
# by maxtr = huge(maxtr) - 1_IK. We suspect this because the error occurs with ikind = i8 | |
# and ikind = i4 for all solvers when testdim = small, but not with ikind = i2 at all. | |
# Update 20240422: The error does not occur any more after the update. WHY? Does this imply | |
# INFINITE CYCLING in the code? | |
if: ${{ matrix.ikind != 'i2' && github.event.inputs.maxtr != '' }} | |
run: | | |
cd fortran/${{ matrix.solver }} | |
$SEDI 's|maxtr = huge(maxtr) - 1_IK|maxtr = ${{ github.event.inputs.maxtr }}|' *.f90 | |
grep 'maxtr = ' *.f90 | |
- name: Conduct the test | |
run: | | |
cd "$ROOT_DIR"/fortran/${{ matrix.solver }} && bash ./flint --all && bash ./mlint --all | |
export FFLAGS=${{ matrix.fflags }} | |
export TESTDIM=${{ matrix.testdim }} | |
cd "$ROOT_DIR"/fortran/tests && make ftest_${{ matrix.ikind }}.${{ matrix.solver }} | |
cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }} | |
export EXAMPLE_NUM=1 && make clean && make ftest | |
export EXAMPLE_NUM=2 && make clean && make ftest | |
- name: Store artifacts | |
uses: actions/[email protected] | |
if: always() # Always run even if the workflow is canceled manually or due to overtime. | |
with: | |
name: ${{ matrix.solver }}-${{ matrix.ikind }}-${{ 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 }} | |
# The following job check whether the tests were successful or cancelled due to timeout. | |
# N.B.: Remember to specify `continue-on-error: true` for the job of the tests. | |
check_success_timeout: | |
runs-on: ubuntu-latest | |
if: ${{ !cancelled() }} | |
needs: test | |
steps: | |
- name: Clone the GitHub actions scripts | |
uses: actions/checkout@v4 | |
with: | |
repository: equipez/github_actions_scripts | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
path: scripts | |
- name: Check whether the tests were successful or cancelled due to timeout | |
run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} |