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 62e4278 commit 06109fd
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 38 deletions.
42 changes: 16 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:

jobs:
mac-os:
if: false
strategy:
fail-fast: false
matrix:
Expand All @@ -16,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
Expand All @@ -27,7 +28,7 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-build
with:
Expand All @@ -48,6 +49,7 @@ jobs:
run: ctest --config ${{ matrix.build_type }} --output-on-failure

linux:
if: false
strategy:
fail-fast: false
matrix:
Expand All @@ -57,16 +59,13 @@ jobs:
- clang++-10
- clang++-11
build_type: [ Debug, Release ]

runs-on: ubuntu-20.04

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

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
Expand All @@ -77,7 +76,7 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-build
with:
Expand All @@ -88,31 +87,26 @@ jobs:
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:
if: false
strategy:
fail-fast: false
matrix:
build_type: [Debug, Release]

runs-on: windows-latest

runs-on: windows-2019
env:
CXX: ${{ matrix.compiler }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-deps
with:
Expand All @@ -123,7 +117,7 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache build
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-build
with:
Expand All @@ -132,30 +126,25 @@ jobs:
- 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]
# needs: [mac-os, linux, windows]
strategy:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
platform: [ 'windows-2019', 'ubuntu-latest', 'macos-latest' ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -169,4 +158,5 @@ jobs:
name: Upload artifact (wheels)
with:
name: wheels
path: ./dist/*.whl
path: ./dist/*.whl

13 changes: 13 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Push to release
run-name: Push to release by @${{ github.actor }}

on:
workflow_run:
workflows: ["Build"]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: test
run: echo "test"
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Unit Tests and Coverage
name: Run Unit Tests

on: [push, pull_request]

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
20 changes: 11 additions & 9 deletions cmake/ThirdPartyLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ function(git_submodule)
endif()

message(VERBOSE "Trying to update submodule in ${GitSubmodule_PATH}")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init -- ${GitSubmodule_PATH}
WORKING_DIRECTORY ${GitSubmodule_WORKING_DIRECTORY}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(
FATAL_ERROR
"git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules"
)
if (NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/${GitSubmodule_PATH}/CMakeLists.txt")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init -- ${GitSubmodule_PATH}
WORKING_DIRECTORY ${GitSubmodule_WORKING_DIRECTORY}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(
FATAL_ERROR
"git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules"
)
endif ()
endif()
endfunction()
13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import sys
from distutils.version import LooseVersion

from setuptools import Extension, setup
from setuptools import Extension, setup, find_packages
from setuptools.command.build_ext import build_ext
from setuptools.command.sdist import sdist


class CMakeExtension(Extension):
Expand Down Expand Up @@ -94,7 +95,15 @@ def build_extension(self, ext):
)


class SdistBuild(sdist):
def run(self) -> None:
print("Git submodule update..")
subprocess.check_call(["git", "submodule", "update", "--init"])
super().run()


setup(
ext_modules=[CMakeExtension("signal_tl._cext")],
cmdclass=dict(build_ext=CMakeBuild),
packages=find_packages(),
cmdclass=dict(build_ext=CMakeBuild, sdist=SdistBuild)
)

0 comments on commit 06109fd

Please sign in to comment.