Skip to content

Commit

Permalink
Merge pull request #381 from vsbogd/fix-ubuntu-release
Browse files Browse the repository at this point in the history
Fix release build, MacOSX build, make check on old cmake versions
  • Loading branch information
Necr0x0Der authored Jul 31, 2023
2 parents beb942b + bbbee1e commit 743f01b
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 23 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-auto.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: ci auto

on:
push:
Expand All @@ -12,5 +12,6 @@ jobs:
ci:
uses: ./.github/workflows/common.yml
with:
python-version: '3.7'
os: ubuntu-20.04
python-version: "3.7"
os: "ubuntu-20.04"
cmake-version: "3.16.x"
41 changes: 41 additions & 0 deletions .github/workflows/ci-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ci manual

on:
workflow_dispatch:
inputs:
fail-fast:
description: 'Fail the build after single job fails'
required: true
default: false
type: boolean
os:
description: 'JSON array of OS to be checked'
required: true
default: "[\"ubuntu-20.04\", \"ubuntu-22.04\", \"macos-11\", \"macos-12\", \"macos-13\"]"
type: string
python-version:
description: 'JSON array of Python versions to be checked'
required: true
default: "[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\"]"
type: string
cmake-version:
description: 'JSON array of CMake versions to be checked'
required: true
default: "[\"3.15.x\"]"
type: string

jobs:
build:
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
os: ${{ fromJson(inputs.os) }}
python-version: ${{ fromJson(inputs.python-version) }}
cmake-version: ${{ fromJson(inputs.cmake-version) }}
max-parallel: 5

uses: ./.github/workflows/common.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
cmake-version: ${{ matrix.cmake-version }}
52 changes: 44 additions & 8 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
default: ubuntu-20.04
required: false
type: string
cmake-version:
description: 'CMake version to use'
default: 3.16.x
required: false
type: string

jobs:
run:
Expand All @@ -34,32 +39,63 @@ jobs:
toolchain: stable
override: true

- name: Build and test
- name: Build Rust library
working-directory: ./lib
run: |
cargo check
cargo build
- name: Test Rust library
working-directory: ./lib
run: |
RUST_LOG=hyperon=debug cargo test
- name: Install cbindgen
uses: actions-rs/[email protected]
with:
command: install
args: cbindgen

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install CMake
uses: jwlawson/[email protected]
with:
cmake-version: ${{ inputs.cmake-version }}

- name: Install Conan
uses: turtlebrowser/[email protected]
with:
version: 1.60.1
version: 1.60.2

- name: Install cbindgen
uses: actions-rs/[email protected]
with:
command: install
args: cbindgen
- name: Setup Conan profile
run: |
conan profile new --detect default
- name: Print environment
run: |
echo "rustc --version"
rustc --version
echo "cbindgen --version"
cbindgen --version
echo "python --version"
python --version
echo "conan --version"
conan --version
echo "conan profile show default"
conan profile show default
echo "gcc --version"
gcc --version
echo "cmake --version"
cmake --version
echo "make --version"
make --version
- name: Setup C API build
run: |
conan profile new --detect default
mkdir -p build
cd build
# specify C compiler as conan could not find it automatically
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# minimum version required by $<IF..> generator expression
cmake_minimum_required(VERSION 3.10.2)
# Minimal version supported by hyperonc
cmake_minimum_required(VERSION 3.15)

project(hyperon)

Expand Down Expand Up @@ -43,5 +43,5 @@ message(STATUS "HYPERONPY_BINARY_DIR = ${HYPERONPY_BINARY_DIR}")

enable_testing()
add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --test-dir "${HYPERONC_BINARY_DIR}"
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --test-dir "${HYPERONPY_BINARY_DIR}")
COMMAND cd "${HYPERONC_BINARY_DIR}" && ${CMAKE_CTEST_COMMAND} --no-tests=error --output-on-failure
COMMAND cd "${HYPERONPY_BINARY_DIR}" && ${CMAKE_CTEST_COMMAND} --no-tests=error --output-on-failure)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN sh /tmp/rustup.sh -y && rm /tmp/rustup.sh
ENV PATH="${PATH}:/home/user/.cargo/bin"
RUN cargo install cbindgen

RUN python3 -m pip install conan==1.60.1 pip==23.1.2
RUN python3 -m pip install conan==1.60.2 pip==23.1.2
ENV PATH="${PATH}:/home/user/.local/bin"
RUN conan profile new --detect default

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Rust (see the Notes at the installation page).
* Python3 and Python3-dev (3.7 or later)
* Pip (23.1.2 or later)
* GCC (7.5 or later)
* CMake (3.10 or later)
* CMake (3.15 or later)

* Install cbindgen:
```
Expand All @@ -59,7 +59,7 @@ cargo install --force cbindgen

* Install Conan and make default Conan profile:
```
python3 -m pip install conan==1.60.1
python3 -m pip install conan==1.60.2
conan profile new --detect default
```

Expand Down
6 changes: 3 additions & 3 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# minimum version required by $<IF..> generator expression
cmake_minimum_required(VERSION 3.10.2)
# Minimal version which allows building dependencies from sources
cmake_minimum_required(VERSION 3.15)
project(hyperonc)

enable_testing()
Expand All @@ -9,7 +9,7 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
execute_process(
# --build is required to build dependencies from source under cibuildwheel
# environment
COMMAND conan install --build -- ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND cmake -E env CC= CXX= conan install --build -- ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
Expand Down
2 changes: 1 addition & 1 deletion python/install-hyperonc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sh /tmp/rustup.sh -y && rm /tmp/rustup.sh
export PATH="${PATH}:${HOME}/.cargo/bin"
cargo install cbindgen

python3 -m pip install conan==1.60.1 pip==23.1.2
python3 -m pip install conan==1.60.2 pip==23.1.2
PATH="${PATH}:${HOME}/.local/bin"
conan profile new --detect default

Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools==65.6.3", "conan==1.60.1", "cmake==3.26.4"]
requires = ["setuptools==65.6.3", "conan==1.60.2", "cmake==3.26.4"]
build-backend = "setuptools.build_meta"

[project]
Expand Down

0 comments on commit 743f01b

Please sign in to comment.