Skip to content

Commit

Permalink
Github actions update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhjp01 committed Jul 18, 2023
1 parent 09783f3 commit f6cf05b
Show file tree
Hide file tree
Showing 16 changed files with 432 additions and 155 deletions.
187 changes: 187 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Build

on:
push:
pull_request:
workflow_dispatch:
inputs:
publish_artifacts:
description: 'Publish artifacts'
required: true
default: false

env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache

jobs:
mac-os:
strategy:
fail-fast: false
matrix:
xcode: ['13', '14']
build_type: [Debug, Release]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v3
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Install sccache
run: brew install sccache
- name: CMake configure
run: cmake -B build

- working-directory: build/
run: cmake --build . --config ${{ matrix.build_type }}

- working-directory: build/
run: ctest --config ${{ matrix.build_type }} --output-on-failure

linux:
strategy:
fail-fast: false
matrix:
compiler:
- g++-9
- g++-10
- clang++-10
- clang++-11
build_type: [ Debug, Release ]
runs-on: ubuntu-20.04
env:
CXX: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v3
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: |
curl -SL https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xvz --strip-components=1 --wildcards "*/sccache"
chmod +x sccache
- run: cmake -E make_directory build
- working-directory: build/
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- working-directory: build/
run: cmake --build .
- working-directory: build/
run: ctest --output-on-failure

windows:
strategy:
fail-fast: false
matrix:
build_type: [Debug, Release]
runs-on: windows-2019
env:
CXX: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v3
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: choco install sccache
- run: cmake -E make_directory build
- shell: bash
working-directory: build/
run: cmake $GITHUB_WORKSPACE
- working-directory: build/
run: cmake --build . --config ${{ matrix.build_type }}
- working-directory: build/
run: ctest -C ${{ matrix.build_type }} --output-on-failure

wheels:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
needs: [mac-os, linux, windows]
strategy:
fail-fast: false
matrix:
platform: [ 'windows-2019', 'ubuntu-latest', 'macos-latest' ]
python-version: [ '3.9', '3.10', '3.11' ]
runs-on: ${{ matrix.platform }}
env:
CIBW_BUILD: "cp${{ matrix.python-version }}-manylinux_x86_64 cp${{ matrix.python-version }}-macosx_x86_64 cp${{ matrix.python-version }}-win_amd64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_DEPENDENCY_VERSIONS: latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
cache: 'pip'
- name: Install dependencies
run: pip install build twine cibuildwheel==2.14.1
- name: Build wheels
run: python -m cibuildwheel --output-dir ./dist
- name: Run twine check
run: twine check --strict dist/*
- uses: actions/upload-artifact@v3
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') || github.event.inputs.publish_artifacts == 'true'
name: Upload artifact (wheels)
with:
name: wheels
path: ./dist/*.whl

publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
needs: [wheels]
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
path: ./dist/
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

57 changes: 57 additions & 0 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Sanitizer

on: [push, pull_request]

env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache

jobs:
sanitizer:
strategy:
fail-fast: false
matrix:
cxx: [g++, clang++]
sanitizer: [address, undefined]

runs-on: ubuntu-20.04

env:
CXX: ${{ matrix.cxx }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: |
curl -SL https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xvz --strip-components=1 --wildcards "*/sccache"
chmod +x sccache
- run: cmake -E make_directory build

- working-directory: build/
run: cmake $GITHUB_WORKSPACE -DBUILD_EXAMPLES=OFF -DCMAKE_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }}"

- working-directory: build/
run: cmake --build .

- working-directory: build/
run: ctest --output-on-failure
46 changes: 46 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Static Analysis

on: [push, pull_request]

env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache

jobs:
static-analysis:
runs-on: ubuntu-20.04
env:
CC: clang-10
CXX: clang++-10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: |
curl -SL https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xvz --strip-components=1 --wildcards "*/sccache"
chmod +x sccache
- name: Install install static analyzers
run: sudo apt install clang-tidy iwyu
- name: CMake configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=OFF -DENABLE_TESTING=OFF -DENABLE_STATIC_ANALYSIS=ON
- name: CMake build
run: cmake --build build --config Debug -j --clean-first
49 changes: 49 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run Unit Tests

on: [push, pull_request]

env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache

jobs:
tests:
runs-on: ubuntu-20.04
env:
CC: gcc-9
CXX: g++-9
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-deps
with:
path: .cache/deps
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/ThirdPartyDeps.cmake') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
env:
cache-name: cache-build
with:
path: .cache/sccache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install sccache
run: |
curl -SL https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz | tar xvz --strip-components=1 --wildcards "*/sccache"
chmod +x sccache
- name: CMake configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON -DENABLE_TESTING=ON
- name: CMake build
run: cmake --build build --config Debug -j --clean-first
- name: CTest
working-directory: build/
run: ctest --output-on-failure


5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include(CMakePrintHelpers)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CTest)
include(StaticAnalyzers)

# Options
option(SIGNALTL_TEST "Build signaltl test suite?" ${SIGNALTL_MASTER_PROJECT})
Expand All @@ -29,6 +30,7 @@ option(SIGNALTL_EXAMPLES "Build the examples?" ${SIGNALTL_MASTER_PROJECT})
option(SIGNALTL_INSTALL "Install the library and header files?"
${SIGNALTL_MASTER_PROJECT})
option(SIGNALTL_PYTHON_BINDINGS "Build the Python extension?" ON)
option(ENABLE_STATIC_ANALYSIS "Enable clang-tidy and include-what-you-use" OFF)

set(_SIGNALTL_BUILD_THE_TESTS
OFF
Expand Down Expand Up @@ -64,6 +66,9 @@ target_compile_features(signaltl PUBLIC cxx_std_17)
target_link_libraries(signaltl PRIVATE mono_wedge::mono_wedge)
target_link_libraries(signaltl PUBLIC fmt::fmt)
set_target_properties(signaltl PROPERTIES POSITION_INDEPENDENT_CODE ON)
enable_clang_tidy(signaltl)
enable_include_what_you_use(signaltl)

if(MSVC)
target_compile_options(signaltl PRIVATE /W4 /WX /utf-8)
else()
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ graft third_party
graft signal_tl
graft src

prune .cache
prune .github
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![pypi](https://badge.fury.io/py/signal-temporal-logic.svg)](https://badge.fury.io/py/signal-temporal-logic)
[![pypi](https://badge.fury.io/py/mvx-stl.svg)](https://badge.fury.io/py/mvx-stl)

# mvx-stl

Expand Down
Loading

0 comments on commit f6cf05b

Please sign in to comment.