Merge pull request #38 from Shareong/main #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: FISCO-BCOS GitHub Actions | |
on: | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "Changelog.md" | |
- "README.md" | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "Changelog.md" | |
- "README.md" | |
release: | |
types: [published, created, edited] | |
env: | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
jobs: | |
build_with_clang: | |
name: build_with_clang | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: | | |
/home/runner/vcpkg | |
/Users/runner/vcpkg/ | |
ccache | |
key: vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
restore-keys: | | |
vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
vcpkg-clang-v1-notest-${{ runner.temp }}-${{ github.base_ref }}- | |
vcpkg-clang-v1-notest-${{ runner.temp }}- | |
- name: install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install ccache | |
- name: install Ubuntu dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt install -y git curl build-essential clang cmake ccache | |
- name: configure | |
if: runner.os == 'macOS' | |
run: export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) && CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake . -DTESTS=ON | |
- name: configure | |
if: runner.os == 'Linux' | |
run: CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake . -DTESTS=ON | |
- name: compile | |
run: make -j2 | |
- name: run test | |
run: CTEST_OUTPUT_ON_FAILURE=TRUE make test ARGS="--output-on-failure" | |
build_with_gcc: | |
name: build_with_gcc | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: /home/runner/vcpkg | |
key: vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
restore-keys: | | |
vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
vcpkg-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}- | |
vcpkg-gcc-v1-notest-${{ runner.temp }}- | |
- uses: actions/cache@v2 | |
id: ccache | |
with: | |
path: ccache | |
key: cache-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
restore-keys: | | |
ccache-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
cache-gcc-v1-notest-${{ runner.temp }}-${{ github.base_ref }}- | |
cache-gcc-v1-notest-${{ runner.temp }}- | |
- name: install Ubuntu dependencies | |
run: sudo apt install -y git curl build-essential cmake ccache lcov | |
- name: configure | |
run: cmake . -DTESTS=ON -DCOVERAGE=ON -DDEBUG=on | |
- name: compile | |
run: make -j2 | |
- name: run test | |
run: CTEST_OUTPUT_ON_FAILURE=TRUE make test | |
- name: generate coverage | |
run: make cov | |
- name: upload code coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.info | |
name: bcos-utilities coverage | |
build_with_centos: | |
name: build_with_centos | |
runs-on: ubuntu-latest | |
container: | |
image: docker.io/centos:7 | |
volumes: | |
- /github/home/vcpkg:/github/home/vcpkg | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: | | |
/home/runner/vcpkg | |
/github/home/vcpkg | |
ccache | |
key: vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
restore-keys: | | |
vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
vcpkg-centos-v1-notest-${{ runner.temp }}-${{ github.base_ref }}- | |
vcpkg-centos-v1-notest-${{ runner.temp }}- | |
- name: install CentOS dependencies | |
run: | | |
yum install -y epel-release centos-release-scl | |
yum install -y git make gcc gcc-c++ glibc-static glibc-devel cmake3 ccache devtoolset-7 openssl libzstd-devel zlib-devel flex bison python-devel python3-devel && source /opt/rh/devtoolset-7/enable | |
- name: configure and compile | |
run: | | |
source /opt/rh/devtoolset-7/enable | |
# mkdir -p build && cd build | |
cmake3 . -DTESTS=ON | |
make -j2 | |
CTEST_OUTPUT_ON_FAILURE=TRUE make test ARGS="--output-on-failure" | |
build_with_windows: | |
name: build_with_windows | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: | | |
/home/runner/vcpkg | |
/github/home/vcpkg | |
/Users/runner/vcpkg | |
/home/runner/vcpkg/_Base/Download/ | |
/github/home/vcpkg/_Base/Download/ | |
/Users/runner/vcpkg/_Base/Download/ | |
C:/vcpkg/ | |
C:/vcpkg/_Base/Download/ | |
ccache | |
key: vcpkg-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
restore-keys: | | |
vcpkg-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} | |
vcpkg-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}- | |
vcpkg-msvc-v3-notest-${{ runner.temp }}- | |
- name: Add MSbuild to PATH | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: configure | |
if: runner.os == 'Windows' | |
run: mkdir -p build && cd build && cmake -G "Visual Studio 16 2019" -A x64 ../ | |
- name: compile | |
run: | |
cd build && MSBuild /version && MSBuild bcos-utilities.sln /p:Configuration=Release /p:Platform=x64 |