Skip to content

Printout change for automated builds #274

Printout change for automated builds

Printout change for automated builds #274

Workflow file for this run

name: CI
on: [push, pull_request]
env:
BUILD_DIR: _build
PIP_PACKAGES: >-
meson
cmake
ninja
PIP_EXTRAS: >-
pkgconfig
numpy
ase
matplotlib
LINUX_INTEL_COMPONENTS: >-
intel-oneapi-compiler-fortran-2023.1.0
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0
intel-oneapi-mkl-2023.1.0
intel-oneapi-mkl-devel-2023.1.0
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build: [cmake]
build-type: [debug]
compiler: [gnu]
version: [11,12]
include:
- os: ubuntu-latest
build: cmake
build-type: debug
compiler: intel
version: 2023.1.0
- os: macos-latest
build: cmake
build-type: debug
compiler: gnu
version: 12
- os: ubuntu-latest
build: cmake
build-type: debugoptimized
compiler: gnu
version: 12
- os: ubuntu-latest
build: meson
build-type: debugoptimized
compiler: intel
version: 2023.1.0
defaults:
run:
shell: ${{ matrix.shell || 'bash' }}
env:
FC: ${{ matrix.compiler == 'intel' && 'ifort' || 'gfortran' }}
CC: ${{ matrix.compiler == 'intel' && 'icx' || 'gcc' }}
GCC_V: ${{ matrix.version }}
PYTHON_V: 3.9
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_V }}
- name: Link pre-installed GCC and FC (macOS)
if: ${{ contains(matrix.os, 'macos') && matrix.compiler == 'gnu' }}
run: |
brew install openblas
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++
echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV
echo "LDFLAGS=-L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV
- name: Install GCC (Linux)
if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gnu' }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
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 libopenblas (Linux GNU build only)
if: ${{ matrix.compiler == 'gnu' && matrix.build-type == 'debugoptimized' }}
run: sudo apt-get update && sudo apt-get install -y libopenblas-dev
- name: Prepare for cache restore
if: ${{ matrix.compiler == 'intel' }}
run: |
sudo mkdir -p /opt/intel
sudo chown $USER /opt/intel
- name: Cache Intel install
if: ${{ matrix.compiler == 'intel' }}
id: cache-install
uses: actions/cache@v4
with:
path: /opt/intel/oneapi
key: install-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}
- name: Install Intel (Linux)
if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }}
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/${{ env.KEY }}
sudo apt-key add ${{ env.KEY }}
rm ${{ env.KEY }}
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install ${{ env.PKG }}
env:
KEY: GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
PKG: ${{ env.LINUX_INTEL_COMPONENTS }}
- name: Setup Intel oneAPI environment
if: ${{ matrix.compiler == 'intel' }}
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Git Sumbodules checkout
run: |
git submodule update --init
- name: Install build and test dependencies
if: ${{ ! contains(matrix.os, 'windows') }}
run: pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }}
- name: Configure build (meson)
if: ${{ matrix.build == 'meson' }}
run: >-
meson setup ${{ env.BUILD_DIR }}
--buildtype=debugoptimized
--prefix=$PWD/_dist
--libdir=lib
--warnlevel=0
# ${{ env.MESON_ARGS }}
# env:
# COVERAGE: ${{ matrix.build-type == 'coverage' }}
# MESON_ARGS: >-
# ${{ matrix.compiler == 'intel' && '-Dfortran_link_args=-qopenmp -Dapi=false' || '' }}
# ${{ contains(matrix.os, 'macos') && '-Dlapack=openblas' || '' }}
- name: Configure build (CMake, debug)
if: ${{ matrix.build == 'cmake' && matrix.build-type == 'debug' }}
run: >-
cmake -B${{ env.BUILD_DIR }}
-GNinja
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DCMAKE_INSTALL_LIBDIR=lib
- name: Configure build (CMake, static)
if: ${{ matrix.build == 'cmake' && matrix.build-type == 'debugoptimized' }}
run: >-
cmake -B${{ env.BUILD_DIR }}
-GNinja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
-DCMAKE_INSTALL_LIBDIR=lib
-DSTATICBUILD=ON
- name: Build project
run: ninja -C ${{ env.BUILD_DIR }}
- name: Run unit tests (ctest)
if: ${{ matrix.build == 'cmake' && matrix.compiler == 'gnu' }}
run: |
ctest --output-on-failure --parallel 2 -R '^crest/'
working-directory: ${{ env.BUILD_DIR }}
env:
OMP_NUM_THREADS: 1,2,1
- name: Install project
run: |
ninja -C ${{ env.BUILD_DIR }} install
echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV
- name: Create package
if: ${{ matrix.build-type == 'debugoptimized' }}
run: |
mkdir crest
cp COPYING crest/LICENSE
cp COPYING.LESSER crest/LICENSE.LESSER
cp _dist/bin/crest crest/
tar cvf ${{ env.OUTPUT }} crest
xz -T0 ${{ env.OUTPUT }}
echo "CREST_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
env:
OUTPUT: crest-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}.tar
- name: Upload package
if: ${{ matrix.build-type == 'debugoptimized' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.CREST_OUTPUT }}
path: ${{ env.CREST_OUTPUT }}
continuous-delivery:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: latest
steps:
- uses: actions/checkout@v4
- name: Install github-release
run: |
go install github.com/github-release/github-release@latest
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Set environment variables
run: |
echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV
echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV
- name: Move/Create continuous tag
run: |
git tag --force ${{ env.RELEASE_TAG }} ${{ github.sha }}
git push --tags --force
- name: Get Time
run: echo "TIME=$(date -u '+%Y/%m/%d, %H:%M')" >> $GITHUB_ENV
- name: Check continuous release status
run: |
if ! github-release info -t ${{ env.RELEASE_TAG }} > /dev/null 2>&1; then
echo "RELEASE_COMMAND=release" >> $GITHUB_ENV
else
echo "RELEASE_COMMAND=edit" >> $GITHUB_ENV
fi
- name: Setup continuous release
run: >-
github-release ${{ env.RELEASE_COMMAND }}
--tag ${{ env.RELEASE_TAG }}
--name "Continuous release version"
--description "$DESCRIPTION"
--pre-release
env:
DESCRIPTION: |
Created on ${{ env.TIME }} UTC by @${{ github.actor }} with commit ${{ github.sha }}.
This is an automated distribution of the latest CREST version.
This version is only minimally tested and may be unstable or even crash.
Use with caution!
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }} # This will download all files
- name: Create SHA256 checksums
run: |
for dir in crest-*.tar.xz; do
if [ -d "$dir" ]; then
sha256sum "$dir/$dir" > "$dir.sha256.txt"
fi
done
- name: Upload CREST tarballs to release
run: |
for dir in crest-*.tar.xz; do
if [ -d "$dir" ]; then
github-release upload \
--tag ${{ env.RELEASE_TAG }} \
--replace \
--name "${dir}" \
--file "$dir/$dir"
fi
done
- name: Upload SHA256 checksums to release
run: |
for file in crest-*.tar.xz.sha256.txt; do
github-release upload \
--tag ${{ env.RELEASE_TAG }} \
--replace \
--name "$file" \
--file "$file"
done