Skip to content

Auto push benchmark results by GitHub Action for Linux + ifx #341

Auto push benchmark results by GitHub Action for Linux + ifx

Auto push benchmark results by GitHub Action for Linux + ifx #341

Workflow file for this run

name: build-and-test
on:
push:
#schedule:
# - cron: '*/120 8-18 * * *' # every 2 hours from 8:00 to 18:00 every day
jobs:
wheel: # the first job
# current job matrix. if modified, remember to UPDATE the strategy in the next job
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
toolchain:
- { exe: gfortran, compiler: gcc, version: 13 }
- { exe: ifort, compiler: intel-classic, version: "2021.10" }
- { exe: ifx, compiler: intel, version: "2023.2" }
exclude:
- os: macos-12
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS
- os: macos-14
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS on arm64
- os: macos-14
toolchain: { exe: ifort, compiler: intel-classic, version: "2021.10" } # no support for macOS on arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps: # job steps
- name: Check-out repository
uses: actions/checkout@v4
- name: Set up Fortran compiler (FC) [all except Windows + gfortran] # except: use pre-installed gfortran
if: runner.os != 'Windows' || matrix.toolchain.exe != 'gfortran'
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Set up NMake build tool [Windows]
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
#- name: debug
# shell: bash
# run: ifort -help
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Upgrade package installer for Python
shell: bash
run: python3 -m pip install --upgrade pip
- name: Install Python dependences
shell: bash
run: python3 -m pip install '.[ci,test]' # ci extras from pyproject.toml
- name: Fix reinstalling gcc [macOS] # needed because of `brew reinstall gcc`
if: runner.os == 'macOS'
shell: bash
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
- name: Create job scripts
shell: bash
run: >
python3 scripts.py
--platform ${{ runner.os }}
--compiler ${{ matrix.toolchain.exe }}
--mode debug
--bash-syntax
- name: Print some build-specific variables
shell: bash
run: scripts/print_build_variables.sh # bash -x scripts/print_build_variables.sh for printing commands
- name: Download CFML repository
shell: bash
run: |
scripts/create_cfml_repo_dir.sh
scripts/download_cfml_repo.sh
- name: Build CFML static library
shell: bash
run: |
scripts/create_cfml_build_dir.sh
scripts/rename_global_deps_file.sh
scripts/build_cfml_objs.sh
scripts/delete_renamed_global_deps_file.sh
scripts/build_cfml_static_lib.sh
scripts/create_cfml_dist_dir.sh
scripts/copy_built_to_cfml_dist.sh
- name: Build und run CFML functional test programs (incl. benchmarks)
# 1st combination: this always fails with 'Undefined symbols...' error
# 2nd combination: this randomly fails with test__Simple_calc_powder__SrTiO3s 'forrtl: severe (157): Program Exception - access violation'
if: |
(runner.os != 'macOS' || matrix.toolchain.exe != 'ifort')
&&
(runner.os != 'Windows' || matrix.toolchain.exe != 'ifx')
shell: bash
run: |
scripts/build_cfml_test_programs.sh
scripts/run_cfml_functional_tests_no_benchmarks.sh
scripts/run_cfml_functional_tests_with_benchmarks.sh
- name: Push benchmark results to repository
uses: EndBug/add-and-commit@v9
with:
add: '.benchmarks'
message: 'Auto push benchmark results by GitHub Action for ${{ runner.os }} + ${{ matrix.toolchain.exe }}'
pull: '--rebase --autostash'
- name: Download PYCFML repository
shell: bash
run: |
scripts/create_pycfml_repo_dir.sh
scripts/download_pycfml_repo.sh
- name: Copy powder_mod from CFML to PYCFML
shell: bash
run: scripts/copy_powder_mod_to_pycfml_repo.sh
- name: Build some PYCFML modules one by one
shell: bash
run: |
scripts/create_pycfml_build_dir.sh
scripts/build_pycfml_objs.sh
scripts/build_pycfml_shared_objs_or_dynamic_libs.sh
scripts/create_pycfml_dist_dir.sh
scripts/copy_built_to_pycfml_dist.sh
scripts/change_runpath_for_built_pycfml.sh
- name: Copy extra files to PYCFML dist
shell: bash
run: |
scripts/copy_extra_libs_to_pycfml_dist.sh
scripts/copy_init_file_to_pycfml_dist.sh
scripts/copy_cfml_databases_to_pycfml_dist.sh
- name: Create Python package wheel of PYCFML
shell: bash
run: |
scripts/validate_pyproject_toml.sh
scripts/create_pycfml_python_wheel.sh
scripts/rename_pycfml_python_wheel.sh
- name: Prepare for uploading Python package wheel of PYCFML
shell: bash
run: echo "WHEEL_DIR=$(python3 scripts.py --print-wheel-dir)" >> $GITHUB_ENV
- name: Upload zipped Python package wheel of PYCFML for next job
uses: actions/upload-artifact@v4
with: # if name or path modified, remember to UPDATE those in the download step of the next job
name: pycfml-wheel_${{ matrix.os }}_${{ matrix.toolchain.exe }} # name (without .zip) of the zip file to be uploaded
path: ${{ env.WHEEL_DIR }} # all files from this directory are zipped
if-no-files-found: "error"
compression-level: 0
tests: # the second job
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
toolchain:
- { exe: gfortran, compiler: gcc, version: 13 }
- { exe: ifort, compiler: intel-classic, version: "2021.10" }
- { exe: ifx, compiler: intel, version: "2023.2" }
exclude:
- os: macos-12
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS
- os: macos-14
toolchain: { exe: ifx, compiler: intel, version: "2023.2" } # no support for macOS on arm64
- os: macos-14
toolchain: { exe: ifort, compiler: intel-classic, version: "2021.10" } # no support for macOS on arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: wheel # previous job need to be finished first
steps: # job steps
- name: Check-out repository
uses: actions/checkout@v4
- name: Set up python environment
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Upgrade package installer for Python
shell: bash
run: python3 -m pip install --upgrade pip
- name: Install Python dependences
shell: bash
run: python3 -m pip install '.[test]' # test extras from pyproject.toml
- name: Create job step scripts
shell: bash
run: >
python3 scripts.py
--platform ${{ runner.os }}
--compiler ${{ matrix.toolchain.exe }}
--mode debug
--bash-syntax
- name: Prepare for downloading Python package wheel of PYCFML
shell: bash
run: echo "WHEEL_DIR=$(python3 scripts.py --print-wheel-dir)" >> $GITHUB_ENV
- name: Download zipped PYCFML wheel from previous job
uses: actions/download-artifact@v4
with: # name or path are taken from the upload step of the previous job
name: pycfml-wheel_${{ matrix.os }}_${{ matrix.toolchain.exe }} # name (without .zip) of the zipped artifact uploaded on the previous jobs
path: ${{ env.WHEEL_DIR }} # directory to extract downloaded zipped artifacts
- name: Install PYCFML from downloaded Python package wheel (with dev extras)
shell: bash
run: scripts/install_pycfml_from_wheel.sh
- name: Run PYCFML unit tests
shell: bash
run: scripts/run_pycfml_unit_tests.sh
- name: Run PYCFML powder_mod tests
shell: bash
run: scripts/run_powder_mod_tests.sh
- name: Run PYCFML powder_mod main
shell: bash
run: scripts/run_powder_mod_main.sh