Merge pull request #714 from danieljprice/ifdef-squash #29
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: build | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'README.md' | |
| pull_request: | |
| branches: [ master ] | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'README.md' | |
| env: | |
| OMP_STACKSIZE: 512M | |
| SPLASH_DIR: ${{ github.workspace }}/splash | |
| PHANTOM_DIR: ${{ github.workspace }} | |
| WEB_USER: github | |
| WEB_SERVER: data.phantom.cloud.edu.au | |
| WEB_HTML_DIR: /var/www/html | |
| BUILD_LOG_DIR: /ci/build/logs | |
| NPARALLEL: 32 | |
| jobs: | |
| matrix_prep: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| batch: ${{ steps.set-sequence.outputs.batch }} | |
| nbatch: ${{ steps.set-sequence.outputs.nbatch }} | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@v4 | |
| - name: Generate sequence of batch numbers for normal tests, or run sequentially for scheduled tests | |
| id: set-sequence | |
| run: | | |
| if [[ ${{ github.event_name == 'schedule' }} ]]; then | |
| range=$(jq -ncR "[range(1;${NPARALLEL}+1)]") | |
| echo "::set-output name=batch::${range}" | |
| echo "::set-output name=nbatch::${NPARALLEL}" | |
| else | |
| echo "::set-output name=batch::[1]" | |
| echo "::set-output name=nbatch::1" | |
| fi | |
| build: | |
| needs: matrix_prep | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| system: | |
| - aocc | |
| - gfortran | |
| - ifort | |
| - ifx | |
| batch: ${{ fromJson(needs.matrix_prep.outputs.batch) }} | |
| name: build (batch ${{ matrix.batch }}/${{ needs.matrix_prep.outputs.nbatch }}, SYSTEM=${{ matrix.system }}) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Nuke the github workspace before doing anything" | |
| run: rm -r ${{ github.workspace }} && mkdir ${{ github.workspace }} | |
| - name: Update package list | |
| run: sudo apt-get update | |
| - name: Setup Intel compiler | |
| if: matrix.system == 'ifort' || matrix.system == 'ifx' | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.system == 'ifort' && 'intel-classic' || 'intel' }} | |
| - name: Install AOCC compiler | |
| if: matrix.system == 'aocc' | |
| id: aocc-install | |
| run: | | |
| REPO_NAME=aocc_flang | |
| TMP_DIR="$(mktemp -d)" | |
| cd "$TMP_DIR" || exit 42 | |
| git clone https://github.com/zaikunzhang/"$REPO_NAME".git | |
| cd "$REPO_NAME" || exit 42 | |
| AOCC_7Z="aocc_flang.deb.7z.001" | |
| 7za x "$AOCC_7Z" -aoa # -aoa: overwrite all existing files without prompt | |
| sudo apt update && sudo apt install p7zip-full libncurses* -y # libncurses* needed for libtinfo.so | |
| sudo dpkg -i "$TMP_DIR"/"$REPO_NAME"/aocc_flang.deb | |
| rm -rf "$TMP_DIR" | |
| # Run the script that sets the necessary environment variables and then damp them to $GITHUB_ENV | |
| # so that they are available in subsequent steps. | |
| if [[ -d /opt/AMD ]] ; then | |
| AOCCDIR="$(find /opt/AMD -maxdepth 1 -name "aocc-compiler*" -type d -print | sort | tail -n 1)" | |
| AOCC_ENVSH="$(find "$AOCCDIR" -name "*setenv*.sh" -type f)" | |
| #shellcheck disable=SC1090 | |
| source "$AOCC_ENVSH" | |
| AFLANG="$(find "$AOCCDIR" -type f -executable -name "clang-*" | grep -E "clang-[0-9]{2}" | head -1)" | |
| if [[ -n "$AFLANG" ]] ; then sudo ln -s "$AFLANG" "$(dirname "$AFLANG")"/aflang ; fi | |
| export PATH=$(dirname "$AFLANG"):$PATH | |
| else | |
| exit 1 | |
| fi | |
| env | grep -i 'aocc\|AMD' >> "$GITHUB_ENV" | |
| # Show the result of the installation. | |
| echo "The AOCC flang installed is:" | |
| aflang --version | |
| echo "The path to AOCC flang is:" | |
| command -v aflang | |
| - name: Install numpy and matplotlib for analysis unit tests | |
| run: | | |
| sudo apt-get install -y python3-numpy | |
| sudo apt-get install -y python3-matplotlib | |
| - name: "Clone phantom" | |
| uses: actions/checkout@v4 | |
| - name: "Grab a copy of splash source code" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: danieljprice/splash | |
| path: splash | |
| - name: "Create logs directory" | |
| if: github.event_name == 'schedule' | |
| run: mkdir logs | |
| - name: "Run buildbot.sh" | |
| run: ./buildbot.sh --url http://${WEB_SERVER}/${BUILD_LOG_DIR} --parallel ${{ matrix.batch }} ${{ env.NPARALLEL }} | |
| working-directory: scripts | |
| env: | |
| SYSTEM: ${{ matrix.system }} | |
| RETURN_ERR: yes | |
| - name: Summary of build failures with SYSTEM=${{ matrix.system }} | |
| if: always() | |
| run: cat logs/build-failures-${{ matrix.system }}.txt || true | |
| - name: Summary of setup failures with SYSTEM=${{ matrix.system }} | |
| if: always() | |
| run: cat logs/setup-failures-${{ matrix.system }}.txt || true | |
| - name: Summary of analysis failures with SYSTEM=${{ matrix.system }} | |
| if: always() | |
| run: cat logs/analysis-failures-${{ matrix.system }}.txt || true | |
| # Gather results into a dummy job that will fail if the previous job fails | |
| gather_results: | |
| if: ${{ always() && github.event_name != 'schedule' }} | |
| needs: | |
| - build | |
| # This name matches the branch protection requirement | |
| name: build | |
| # Always run on github runner; no need to use custom runner for the check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check all builds succeeded | |
| run: | | |
| if [[ "${{ needs.build.result }}" == "success" ]]; then | |
| echo "All build succeeded" | |
| else | |
| echo "At least one build failed" | |
| exit 1 | |
| fi |