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 9d90dee commit 6bc2f0d
Show file tree
Hide file tree
Showing 18 changed files with 528 additions and 160 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: [ '39', '310', '311' ]
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


Loading

0 comments on commit 6bc2f0d

Please sign in to comment.