Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
msoos authored Feb 7, 2024
1 parent d5f4379 commit 8b88745
Showing 1 changed file with 54 additions and 57 deletions.
111 changes: 54 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: build
name: binary build

on:
push:
branches:
- master

on: [push, pull_request]

jobs:
build:
Expand All @@ -10,85 +14,78 @@ jobs:
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: ${{ matrix.os }}


strategy:
matrix:
os: [ubuntu-20.04]
# os: [windows-latest]
os: [ubuntu-20.04, windows-2022, macos-13]
build_type: ['Release']
staticcompile: [1, 0]
staticcompile: ['ON', 'OFF']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4.1.1

- id: boost
name: Build Boost
# You may pin to the exact commit or the version.
# uses: egor-tensin/build-boost@bfb61b9fccc827f0c502fc400f6f63cc74f2d79a
uses: egor-tensin/build-boost@v1
with:
# Version to build
version: 1.74.0
# Space-separated list of libraries
libraries: program_options
# Target platform
platform: auto
# Configuration to build
configuration: Release
# Build static libraries
static: ${{ matrix.staticcompile }}
# Link to the static runtime
static-runtime: ${{ matrix.staticcompile }}
# Destination directory
#directory: # optional

# - name: test
# run: |
# dir ${{ steps.boost.outputs.librarydir }}
# dir ${{ steps.boost.outputs.root }}
# install dependencies
- name: Install boost & help2man for Linux
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get update && sudo apt-get install -yq help2man

- name: Installing Numpy
run: |
pip install pip --upgrade
pip install numpy lit
- name: Setup Python
uses: actions/[email protected]
# with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
# python-version: # optional, default is 3.x
# The target architecture (x86, x64) of the Python interpreter.
# architecture: # optional
# Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
# token: # optional, default is ${{ github.token }}
- name: Add git submodules for Linux only (not needed for non-testing)
if: matrix.os == 'ubuntu-20.04'
run: git submodule update --init

- name: Configure CMake static
- name: Configure CMake for linux
if: matrix.os == 'ubuntu-20.04'
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
#working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
if: matrix.staticcompile == 1
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTATICCOMPILE=ON -D "BOOST_ROOT=${{ steps.boost.outputs.root }}" -D "BOOST_LIBRARYDIR=${{ steps.boost.outputs.librarydir }}"
- name: Configure CMake dynamic
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTING=ON -DSTATICCOMPILE=${{ matrix.staticcompile }}

- name: Configure CMake for non-linux
if: matrix.os != 'ubuntu-20.04'
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
#working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
if: matrix.staticcompile == 0
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTATICCOMPILE=OFF -D "BOOST_ROOT=${{ steps.boost.outputs.root }}" -D "BOOST_LIBRARYDIR=${{ steps.boost.outputs.librarydir }}"
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTING=OFF -DSTATICCOMPILE=${{ matrix.staticcompile }}

- name: Build
#working-directory: ${{runner.workspace}}/build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ matrix.build_type }}

#- name: "Install CMS (unix)"
# if: ${{ !contains(matrix.os, 'windows') }}
# run: sudo cmake --install build --config ${{ matrix.build_type }}
- name: Test
#working-directory: ${{runner.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ matrix.build_type }}

- name: Upload Artifact - Linux
if: matrix.os == 'ubuntu-20.04' && matrix.staticcompile == 'ON'
uses: actions/upload-artifact@v3
with:
name: cmsgen-linux-amd64
path: cmsgen

- name: Upload Artifact - Mac
if: matrix.os == 'macos-13' && matrix.staticcompile == 'ON'
uses: actions/upload-artifact@v3
with:
name: cmsgen-mac-amd64
path: cmsgen

#- name: "Install Spix (win)"
# if: ${{ contains(matrix.os, 'windows') }}
# run: cmake --install build --config ${{ matrix.build_type }}
- name: Upload Artifact - Windows
if: matrix.os == 'windows-2022' && matrix.staticcompile == 'ON'
uses: actions/upload-artifact@v3
with:
name: cmsgen-win64.exe
path: Release\cmsgen.exe

0 comments on commit 8b88745

Please sign in to comment.