Run test on mac (#490)

Fixes #490
This commit is contained in:
cyan317
2023-01-31 17:22:28 +00:00
committed by GitHub
parent 992d5a7a70
commit fe5150dba4

View File

@@ -1,9 +1,9 @@
name: Build Clio name: Build Clio
on: on:
push: push:
branches: [master, release/*, develop, develop-next] branches: [master, release/*, develop, develop-next]
pull_request: pull_request:
branches: [master, release/*, develop, develop-next] branches: [master, release/*, develop, develop-next]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -70,58 +70,47 @@ jobs:
path: ${{ github.workspace }}/clio_tests path: ${{ github.workspace }}/clio_tests
build_dev: build_dev:
name: ${{ matrix.os.name }} test name: Build on Mac/Clang14 and run tests
needs: lint needs: lint
continue-on-error: ${{ matrix.os.experimental }} continue-on-error: false
strategy: runs-on: macos-12
fail-fast: false
matrix:
os:
- name: macos-11
experimental: true
- name: macos-12
experimental: false
runs-on: ${{ matrix.os.name }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
path: clio path: clio
- name: Check Boost cache - name: Check Boost cache
id: boost id: boost
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: boost path: boost
key: ${{ runner.os }}-boost key: ${{ runner.os }}-boost
- name: Build boost - name: Build boost
if: steps.boost.outputs.cache-hit != 'true' if: steps.boost.outputs.cache-hit != 'true'
run: | run: |
curl -s -OJL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz" curl -s -OJL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz"
tar zxf boost_1_77_0.tar.gz tar zxf boost_1_77_0.tar.gz
mv boost_1_77_0 boost mv boost_1_77_0 boost
cd boost cd boost
./bootstrap.sh ./bootstrap.sh
if [[ ${{ matrix.os.name }} =~ mac ]];then ./b2 cxxflags="-std=c++14"
mac_flags='cxxflags="-std=c++14"' - name: install deps
fi run: |
./b2 ${mac_flags} brew install pkg-config protobuf openssl ninja cassandra-cpp-driver bison
- name: install deps - name: Build clio
run: | run: |
if [[ ${{ matrix.os.name }} =~ mac ]];then export BOOST_ROOT=$(pwd)/boost
brew install pkg-config protobuf openssl ninja cassandra-cpp-driver bison cd clio
elif [[ ${{matrix.os.name }} =~ ubuntu ]];then cmake -B build
sudo apt-get -y install git pkg-config protobuf-compiler libprotobuf-dev libssl-dev wget build-essential doxygen bison flex autoconf clang-format if ! cmake --build build -j$(nproc); then
fi echo '# 🔥🔥 MacOS AppleClang build failed!💥' >> $GITHUB_STEP_SUMMARY
- name: Build clio fi
run: | - name: Run Test
export BOOST_ROOT=$(pwd)/boost run: |
cd clio cd clio/build
cmake -B build ./clio_tests --gtest_filter="-Backend*"
if ! cmake --build build -j$(nproc); then
echo '# 🔥${{ matrix.os.name }}🔥 failed!💥' >> $GITHUB_STEP_SUMMARY
fi
test_clio: test_clio:
name: Test Clio name: Test Clio
@@ -150,57 +139,57 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
path: clio path: clio
- name: Check Boost cache - name: Check Boost cache
id: boost id: boost
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: boost path: boost
key: ${{ runner.os }}-boost key: ${{ runner.os }}-boost
- name: Build boost - name: Build boost
if: steps.boost.outputs.cache-hit != 'true' if: steps.boost.outputs.cache-hit != 'true'
run: | run: |
curl -s -OJL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz" curl -s -OJL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz"
tar zxf boost_1_77_0.tar.gz tar zxf boost_1_77_0.tar.gz
mv boost_1_77_0 boost mv boost_1_77_0 boost
cd boost cd boost
./bootstrap.sh ./bootstrap.sh
./b2 ./b2
- name: install deps - name: install deps
run: | run: |
sudo apt-get -y install git pkg-config protobuf-compiler libprotobuf-dev libssl-dev wget build-essential doxygen bison flex autoconf clang-format gcovr sudo apt-get -y install git pkg-config protobuf-compiler libprotobuf-dev libssl-dev wget build-essential doxygen bison flex autoconf clang-format gcovr
- name: Build clio - name: Build clio
run: | run: |
export BOOST_ROOT=$(pwd)/boost export BOOST_ROOT=$(pwd)/boost
cd clio cd clio
cmake -B build -DCODE_COVERAGE=on -DTEST_PARAMETER='--gtest_filter="-Backend*"' cmake -B build -DCODE_COVERAGE=on -DTEST_PARAMETER='--gtest_filter="-Backend*"'
if ! cmake --build build -j$(nproc); then if ! cmake --build build -j$(nproc); then
echo '# 🔥Ubuntu build🔥 failed!💥' >> $GITHUB_STEP_SUMMARY echo '# 🔥Ubuntu build🔥 failed!💥' >> $GITHUB_STEP_SUMMARY
fi fi
cd build cd build
make clio_tests-ccov make clio_tests-ccov
- name: Code Coverage Summary Report - name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.2.0 uses: irongut/CodeCoverageSummary@v1.2.0
with: with:
filename: clio/build/clio_tests-gcc-cov/out.xml filename: clio/build/clio_tests-gcc-cov/out.xml
badge: true badge: true
output: both output: both
format: markdown format: markdown
- name: Save PR number and ccov report - name: Save PR number and ccov report
run: | run: |
mkdir -p ./UnitTestCoverage mkdir -p ./UnitTestCoverage
echo ${{ github.event.number }} > ./UnitTestCoverage/NR echo ${{ github.event.number }} > ./UnitTestCoverage/NR
cp clio/build/clio_tests-gcc-cov/report.html ./UnitTestCoverage/report.html cp clio/build/clio_tests-gcc-cov/report.html ./UnitTestCoverage/report.html
cp code-coverage-results.md ./UnitTestCoverage/out.md cp code-coverage-results.md ./UnitTestCoverage/out.md
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: UnitTestCoverage name: UnitTestCoverage
path: UnitTestCoverage/ path: UnitTestCoverage/