Skip to content

Continuous integration for Nomad and PyNomad #243

Continuous integration for Nomad and PyNomad

Continuous integration for Nomad and PyNomad #243

Workflow file for this run

# All actions have a name that will be displayed in the "Actions" page in GitHub.
name: Continuous integration for Nomad and PyNomad
# Controls when the action will run.
on:
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "nomad"
nomad:
# The type of runner that the job will run on
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# - {
# name: "Windows -- VS2022", artifact: "Windows_VS2022.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "cl", cxx: "cl",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
# }
# - {
# name: "Windows -- MinGW", artifact: "Windows-MinGW.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "x86_64-w64-mingw32-gcc", cxx: "x86_64-w64-mingw32-g++"
# }
# - {
# name: "Ubuntu", artifact: "Linux.tar.xz",
# os: ubuntu-latest,
# build_type: "Release", cc: "gcc", cxx: "g++"
# }
- {
name: "MacOS", artifact: "macOS.tar.xz",
os: macos-latest,
build_type: "Release", cc: "clang", cxx: "clang++"
}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Usually this is always needed
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Prepare Python environment
run: >-
pip install setuptools wheel cython pytest
- name: Install dependencies on Windows
if: startsWith(matrix.config.name, 'Windows')
run: |
choco install cmake
cmake --version
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu')
run: |
sudo apt-get update
sudo apt-get install cmake
cmake --version
gcc --version
- name: Install dependencies on MacOS
if: startsWith(matrix.config.name, 'MacOS')
run: |
brew install cmake
cmake --version
- name: Configure on LinuxType
if: startsWith(matrix.config.name, 'MacOS') || startsWith(matrix.config.name, 'Ubuntu')
shell: bash
run: |
mkdir instdir
mkdir build
cd build
cmake \
-DCMAKE_CC_COMPILER=${{matrix.config.cc}} \
-DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} \
-DBUILD_TESTS=ON \
-DBUILD_INTERFACE_C=ON \
-DBUILD_INTERFACE_PYTHON=ON \
-DTEST_OPENMP=OFF \
-DCMAKE_INSTALL_PREFIX=../instdir \
..
- name: Configure on WindowsType
if: startsWith(matrix.config.name, 'Windows')
shell: bash
run: |
mkdir instdir
mkdir build
cd build
if [[ "${{matrix.config.name}}" == "Windows -- MinGW" ]]; then
cmake -G "MinGW Makefiles" \
-DTEST_OPENMP=OFF \
-DBUILD_INTERFACE_C=ON \
-DBUILD_EXAMPLES=OFF \
-DCMAKE_INSTALL_PREFIX=../instdir \
..
else
cmake .. -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_PYTHON=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=../instdir
fi
- name: Build
shell: bash
run: |
cmake --build build --config ${{matrix.config.build_type}} --clean-first --parallel 2
- name: Install
shell: bash
run: |
cmake --install build --config ${{matrix.config.build_type}}
- name: Tests
shell: bash
run: |
export PATH=`pwd`/build/bin:$PATH
echo $PATH
cd build
ctest -C ${{matrix.config.build_type}} -E outputqueue_unittestname --output-on-failure
- name: Test (PyNomad wheel)
shell: bash
run: |-
cd interfaces/PyNomad
pip install --force-reinstall dist/*.whl
pytest
- name: Prepare upload
shell: bash
run: |
mv README.txt instdir/.
mv LICENSE instdir/.
cd instdir
tar -cf NOMAD4.tar *
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}
path: instdir/NOMAD4.tar