Skip to content

Commit

Permalink
Support more redhat like platforms (milvus-io#149)
Browse files Browse the repository at this point in the history
- CI refactoring for upport more redhat like distributions
- add rpkg spec, ready for release to fedora copr

Signed-off-by: Ji Bin <[email protected]>
  • Loading branch information
matrixji authored Feb 14, 2022
1 parent ef0ee8d commit 98749b8
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 160 deletions.
229 changes: 76 additions & 153 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,36 @@ on:
- '.clang-tidy'

jobs:
ubuntu:
name: Build and test AMD64 Ubuntu ${{ matrix.ubuntu }}
linux:
name: Build and test AMD64 ${{ matrix.os.distro }} ${{ matrix.os.version }}
runs-on: ubuntu-latest
container: ubuntu:${{ matrix.ubuntu }}
container: ${{ matrix.os.image }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
ubuntu: [18.04, 20.04]
os:
- distro: Ubuntu
version: 18.04
image: ubuntu:18.04
key: u1804
- distro: Ubuntu
version: 20.04
image: ubuntu:20.04
key: u2004
- distro: CentOS
version: 7
image: centos:7
key: c7
- distro: Fedora
version: 34
image: fedora:34
key: fc34
- distro: Fedora
version: 35
image: fedora:35
key: fc35
env:
UBUNTU: ${{ matrix.ubuntu }}
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
Expand All @@ -51,107 +70,70 @@ jobs:
with:
path: |
~/.ccache
key: ubuntu-${{ matrix.ubuntu }}-ccache-${{ github.sha }}
restore-keys: ubuntu-${{ matrix.ubuntu }}-ccache-
key: linux-${{ matrix.os.key }}-ccache-${{ github.sha }}
restore-keys: linux-${{ matrix.os.key }}-ccache-
- name: Cache apk
uses: actions/cache@v2
if: ${{ matrix.os.distro }} == "Ubuntu"
with:
path: |
/var/cache/apt/archives
key: ubuntu-${{ matrix.ubuntu }}-apt-${{ github.sha }}
restore-keys: ubuntu-${{ matrix.ubuntu }}-apt-
key: linux-${{ matrix.os.key }}-ccache-${{ github.sha }}
restore-keys: linux-${{ matrix.os.key }}-ccache-
- name: Cache rpm
uses: actions/cache@v2
if: ${{ matrix.os.distro == 'CentOS' || matrix.os.distro == 'Fedora' }}
with:
path: |
/var/cache/yum
key: linux-${{ matrix.os.key }}-rpm-${{ github.sha }}
restore-keys: linux-${{ matrix.os.key }}-rpm-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Build
run: |
make
- name: Lint
if: ${{ matrix.os.distro == 'Ubuntu' }}
run: |
make lint
- name: Uint Testing
if: ${{ matrix.os.key != 'u2004' }}
run: |
make test
- name: Uint Testing With Coverage
if: ${{ matrix.os.key == 'u2004' }}
run: |
make coverage
- name: Upload coverage
uses: codecov/codecov-action@v2
if: ${{ matrix.os.key == 'u2004' }}
with:
files: ./code_coverage/lcov_output.info
name: ubuntu-${{ matrix.ubuntu }}-coverage
centos:
name: Build and test AMD64 CentOS ${{ matrix.centos }}
runs-on: ubuntu-latest
container: centos:${{ matrix.centos }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
centos: [7]
env:
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache ccache
uses: actions/cache@v2
with:
path: |
~/.ccache
key: centos-${{ matrix.centos }}-ccache-${{ github.sha }}
restore-keys: centos-${{ matrix.centos }}-ccache-
- name: Cache rpm
uses: actions/cache@v2
with:
path: |
/var/cache/yum
key: centos-${{ matrix.centos }}-rpm-${{ github.sha }}
restore-keys: centos-${{ matrix.centos }}-rpm-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Build
- name: Build Packages
run: |
make
- name: Uint Testing
run: |
make test
macos:
name: Build and test macOS ${{ matrix.macos }}
runs-on: macos-${{ matrix.macos }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
macos: [11]
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_CPP2: true
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache ccache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/.ccache
key: macos-${{ matrix.macos }}-ccache-${{ github.sha }}
restore-keys: macos-${{ matrix.macos }}-ccache-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Build
make package
- name: Build with examples apk
if: ${{ matrix.os.distro == 'Ubuntu' }}
run: |
make
- name: Uint Testing
set -e
dpkg -i cmake_build/src/Pack/libmilvus*amd64.deb
mkdir -p cmake_build_example
cd cmake_build_example
cmake ../examples
make -j
- name: Build with examples rpm
if: ${{ matrix.os.distro == 'CentOS' || matrix.os.distro == 'Fedora' }}
run: |
make test
ubuntu-st:
set -e
yum install -y cmake_build/src/Pack/libmilvus{-devel,}-2*.rpm
mkdir -p cmake_build_example
cd cmake_build_example
cmake ../examples
make -j
st-ubuntu:
name: Acceptance Test Ubuntu ${{ matrix.ubuntu }}
runs-on: ubuntu-${{ matrix.ubuntu }}
timeout-minutes: 45
Expand All @@ -160,7 +142,6 @@ jobs:
matrix:
ubuntu: [18.04]
env:
UBUNTU: ${{ matrix.ubuntu }}
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
Expand Down Expand Up @@ -188,64 +169,19 @@ jobs:
- name: System Test
run: |
make st
ubuntu-deb:
name: Package AMD64 Ubuntu ${{ matrix.ubuntu }}
runs-on: ubuntu-latest
container: ubuntu:${{ matrix.ubuntu }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
ubuntu: [18.04, 20.04]
env:
UBUNTU: ${{ matrix.ubuntu }}
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache ccache
uses: actions/cache@v2
with:
path: |
~/.ccache
key: ubuntu-${{ matrix.ubuntu }}-ccache-${{ github.sha }}
restore-keys: ubuntu-${{ matrix.ubuntu }}-ccache-
- name: Cache apk
uses: actions/cache@v2
with:
path: |
/var/cache/apt/archives
key: ubuntu-${{ matrix.ubuntu }}-apt-${{ github.sha }}
restore-keys: ubuntu-${{ matrix.ubuntu }}-apt-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Package
run: |
make package
- name: Build with examples
run: |
set -e
dpkg -i cmake_build/src/Pack/libmilvus*amd64.deb
mkdir -p cmake_build_example
cd cmake_build_example
cmake ../examples
make -j
centos-rpm:
name: Package AMD64 CentOS ${{ matrix.centos }}
runs-on: ubuntu-latest
container: centos:${{ matrix.centos }}
macos:
name: Build and test macOS ${{ matrix.macos }}
runs-on: macos-${{ matrix.macos }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
centos: [7]
macos: [11]
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_CPP2: true
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
steps:
Expand All @@ -255,28 +191,15 @@ jobs:
uses: actions/cache@v2
with:
path: |
~/.ccache
key: centos-${{ matrix.centos }}-ccache-${{ github.sha }}
restore-keys: centos-${{ matrix.centos }}-ccache-
- name: Cache rpm
uses: actions/cache@v2
with:
path: |
/var/cache/yum
key: centos-${{ matrix.centos }}-rpm-${{ github.sha }}
restore-keys: centos-${{ matrix.centos }}-rpm-
${{ github.workspace }}/.ccache
key: macos-${{ matrix.macos }}-ccache-${{ github.sha }}
restore-keys: macos-${{ matrix.macos }}-ccache-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Package
- name: Build
run: |
make package
- name: Build with examples
make
- name: Uint Testing
run: |
set -e
yum install -y cmake_build/src/Pack/libmilvus{-devel,}-2*el*.rpm
mkdir -p cmake_build_example
cd cmake_build_example
cmake ../examples
make -j
make test
12 changes: 7 additions & 5 deletions cmake/MilvusSdkPackagesLinux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ elseif(EXISTS "/etc/centos-release")
## others
elseif(EXISTS "/etc/os-release")
file(READ "/etc/os-release" OS_RELEASE_NAME)
string(REGEX MATCH "NAME=\"([a-zA-Z0-9 /\\.]+)\"" _ ${OS_RELEASE_NAME})
string(REGEX MATCH "NAME=\"?([a-zA-Z0-9 /\\.]+)\"?" _ ${OS_RELEASE_NAME})
set(FULL_PLATFORM ${CMAKE_MATCH_1})
if(FULL_PLATFORM MATCHES "^.*openSUSE.*$")
set(PLATFORM "openSUSE")
elseif(FULL_PLATFORM MATCHES "^.*Fedora.*$")
set(PLATFORM "Fedora")
elseif(FULL_PLATFORM MATCHES "^.*Ubuntu.*$")
set(PLATFORM "Ubuntu")
elseif(FULL_PLATFORM MATCHES "^.*Debian.*$")
Expand All @@ -70,7 +72,7 @@ elseif(EXISTS "/etc/os-release")
set(PLATFORM "CentOS")
endif()
file(READ "/etc/os-release" OS_RELEASE)
string(REGEX MATCH "VERSION=\"([a-zA-Z0-9 /\\.]+)\"" _ ${OS_RELEASE})
string(REGEX MATCH "VERSION=\"?([a-zA-Z0-9 /\\.]+)\"?" _ ${OS_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
endif()

Expand All @@ -86,7 +88,7 @@ MESSAGE(STATUS "Distribution name = ${DISTRO_NAME}")

# release string
set(MILVUS_SDK_RELEASE_STRING "${MILVUS_SDK_RELEASE}")
if(PLATFORM STREQUAL "CentOS")
if(PLATFORM STREQUAL "CentOS" OR PLATFORM STREQUAL "Fedora")
execute_process(
COMMAND rpm --eval %dist
OUTPUT_VARIABLE distro_name OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand All @@ -112,7 +114,7 @@ if(PLATFORM STREQUAL "Debian" OR PLATFORM STREQUAL "Ubuntu")
else()
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
elseif(PLATFORM STREQUAL "CentOS" OR PLATFORM STREQUAL "openSUSE")
elseif(PLATFORM STREQUAL "CentOS" OR PLATFORM STREQUAL "openSUSE" OR PLATFORM STREQUAL "Fedora")
execute_process(COMMAND arch OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

Expand Down Expand Up @@ -149,7 +151,7 @@ set(CPACK_PACKAGE_RELOCATABLE "OFF")
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Pack)
set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)

if (PLATFORM STREQUAL "CentOS" OR PLATFORM STREQUAL "openSUSE")
if (PLATFORM STREQUAL "CentOS" OR PLATFORM STREQUAL "openSUSE" OR PLATFORM STREQUAL "Fedora")
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/libmilvus")
set(CPACK_RPM_COMPONENT_INSTALL ON)
Expand Down
Loading

0 comments on commit 98749b8

Please sign in to comment.