Skip to content

Commit

Permalink
Update CI workflow to latest state as of multicharge (#66)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
marcelmbn authored Aug 1, 2024
1 parent 77f65c6 commit 444e02b
Showing 1 changed file with 36 additions and 98 deletions.
134 changes: 36 additions & 98 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ on: [push, pull_request]
env:
BUILD_DIR: _build
PIP_PACKAGES: >-
meson==0.58.0
meson
cmake
ninja
gcovr
MACOS_BASEKIT_URL: >-
https://registrationcenter-download.intel.com/akdlm/irc_nas/17969/m_BaseKit_p_2021.3.0.3043.dmg
MACOS_HPCKIT_URL: >-
https://registrationcenter-download.intel.com/akdlm/irc_nas/17890/m_HPCKit_p_2021.3.0.3226_offline.dmg
LINUX_INTEL_COMPONENTS: >-
intel-oneapi-compiler-fortran-2021.2.0
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2021.2.0
intel-oneapi-mkl-2021.2.0
intel-oneapi-mkl-devel-2021.2.0
jobs:
build:
Expand All @@ -26,24 +25,18 @@ jobs:
build: [meson, cmake]
build-type: [debug]
compiler: [gnu]
version: [10]
version: [12]

include:
- os: ubuntu-latest
build: fpm
build-type: debug
compiler: gnu
version: 10

- os: ubuntu-latest
build: meson
build-type: coverage
compiler: gnu
version: 9
version: 12

- os: ubuntu-latest
build: meson
build-type: coverage
build-type: debug
compiler: gnu
version: 10

Expand All @@ -53,42 +46,12 @@ jobs:
compiler: gnu
version: 11

- os: ubuntu-latest
build: meson
build-type: debug
compiler: gnu
version: 7

- os: ubuntu-latest
build: cmake
build-type: debug
compiler: gnu
version: 8

- os: ubuntu-latest
build: meson
build-type: debug
compiler: gnu
version: 9

- os: ubuntu-latest
build: meson
build-type: debug
compiler: gnu
version: 11

- os: ubuntu-latest
build: meson
build-type: debug
compiler: intel
version: 2021

- os: macos-latest
build: meson
build-type: debug
compiler: intel
version: 2021

defaults:
run:
shell: ${{ matrix.shell || 'bash' }}
Expand All @@ -97,23 +60,29 @@ jobs:
FC: ${{ matrix.compiler == 'intel' && 'ifort' || 'gfortran' }}
CC: ${{ matrix.compiler == 'intel' && 'icc' || 'gcc' }}
GCC_V: ${{ matrix.version }}
PYTHON_V: 3.8
PYTHON_V: 3.9
OMP_NUM_THREADS: 1,2,1

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_V }}

- name: Install GCC (OSX)
- name: Link pre-installed GCC and FC (macOS)
if: ${{ contains(matrix.os, 'macos') && matrix.compiler == 'gnu' }}
run: |
brew install gcc@${{ env.GCC_V }}
ln -s /usr/local/bin/gfortran-${{ env.GCC_V }} /usr/local/bin/gfortran
ln -s /usr/local/bin/gcc-${{ env.GCC_V }} /usr/local/bin/gcc
ln -s /usr/local/bin/g++-${{ env.GCC_V }} /usr/local/bin/g++
gfortran_path=$( which gfortran-${{ env.GCC_V }} )
gcc_path=$( which gcc-${{ env.GCC_V }} )
gplusplus_path=$( which g++-${{ env.GCC_V }} )
export FC=$gfortran_path
export CC=$gcc_path
export CXX=$gplusplus_path
ln -s $gfortran_path /usr/local/bin/gfortran
ln -s $gcc_path /usr/local/bin/gcc
ln -s $gplusplus_path /usr/local/bin/g++
- name: Install GCC (Linux)
if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gnu' }}
Expand All @@ -122,29 +91,15 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-${{ env.GCC_V}} gfortran-${{ env.GCC_V }}
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }}
- name: Install GCC (Windows)
if: ${{ contains(matrix.os, 'windows') && matrix.compiler == 'gnu' }}
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
git
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-openblas
mingw-w64-x86_64-lapack
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }}
- name: Install fpm
if: ${{ matrix.build == 'fpm' }}
uses: fortran-lang/setup-fpm@v3
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: 'v0.3.0'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare for cache restore
if: ${{ matrix.compiler == 'intel' }}
Expand Down Expand Up @@ -173,24 +128,6 @@ jobs:
KEY: GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
PKG: ${{ env.LINUX_INTEL_COMPONENTS }}

- name: Install Intel HPCKit (OSX)
if: ${{ contains(matrix.os, 'macos') && contains(matrix.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }}
run: |
curl --output ${{ env.OUT }} --url "$URL" --retry 5 --retry-delay 5
hdiutil attach ${{ env.OUT }}
if [ -z "$COMPONENTS" ]; then
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
installer_exit_code=$?
else
sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
installer_exit_code=$?
fi
hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
exit $installer_exit_code
env:
OUT: webimage-hpc.dmg
URL: ${{ env.MACOS_HPCKIT_URL }}
COMPONENTS: all

- name: Setup Intel oneAPI environment
if: ${{ matrix.compiler == 'intel' }}
Expand All @@ -214,7 +151,8 @@ jobs:
${{ env.MESON_ARGS }}
env:
COVERAGE: ${{ matrix.build-type == 'coverage' }}
MESON_ARGS: ${{ matrix.compiler == 'intel' && '-Dfortran_link_args=-qopenmp' || '' }}
MESON_ARGS: >-
${{ matrix.compiler == 'intel' && '-Dfortran_link_args=-qopenmp' || '' }}
- name: Configure build (CMake)
if: ${{ matrix.build == 'cmake' }}
Expand All @@ -224,6 +162,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_FORTRAN_COMPILER=${{ env.FC }}
- name: Build library (fpm)
if: ${{ matrix.build == 'fpm' }}
Expand All @@ -240,7 +179,7 @@ jobs:
- name: Run unit tests (meson)
if: ${{ matrix.build == 'meson' }}
run: |
meson test -C ${{ env.BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2
meson test -C ${{ env.BUILD_DIR }} --print-errorlogs --no-rebuild
- name: Run unit tests (ctest)
if: ${{ matrix.build == 'cmake' }}
Expand All @@ -257,25 +196,24 @@ jobs:
if: ${{ matrix.build != 'fpm' }}
run: |
ninja -C ${{ env.BUILD_DIR }} install
echo "TBLITE_PREFIX=$PWD/_dist" >> $GITHUB_ENV
echo "MCTCLIB_PREFIX=$PWD/_dist" >> $GITHUB_ENV
- name: Create package
if: ${{ matrix.build == 'meson' }}
run: |
tar cvf ${{ env.OUTPUT }} _dist
xz -T0 ${{ env.OUTPUT }}
echo "TBLITE_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
echo "MCTCLIB_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
env:
OUTPUT: tblite-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}.tar
OUTPUT: mctc-lib-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}.tar

- name: Upload package
if: ${{ matrix.build == 'meson' && matrix.build-type != 'coverage' }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.TBLITE_OUTPUT }}
path: ${{ env.TBLITE_OUTPUT }}
name: ${{ env.MCTCLIB_OUTPUT }}
path: ${{ env.MCTCLIB_OUTPUT }}

- name: Upload coverage report
if: ${{ matrix.build == 'meson' && matrix.build-type == 'coverage' }}
uses: codecov/codecov-action@v1

uses: codecov/codecov-action@v4

0 comments on commit 444e02b

Please sign in to comment.