-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (79 loc) · 3.26 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Build python bindings
name: Build python bindings
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
os: [ 'macos-latest', 'ubuntu-20.04' ]
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} build
env:
PROTO_MAJOR: 3
PROTO_MINOR: 11
PROTO_PATCH: 4
steps:
- name: install Linux deps
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
sudo apt-get install -y libssl-dev libgflags-dev libleveldb-dev libgoogle-perftools-dev
- name: install macOS deps
if: runner.os == 'macOS'
run: |
brew update
brew install zlib snappy openssl gnu-getopt coreutils gflags leveldb gperftools boost
- name: checkout from git
uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-python
- name: Cache protobuf
id: cache_protobuf
uses: actions/cache@v2
with:
path: protobuf-${{ env.PROTO_MAJOR }}.${{ env.PROTO_MINOR }}.${{ env.PROTO_PATCH }}/installdir
key: ${{ runner.os }}-protobuf-${{ env.PROTO_MAJOR }}-${{ env.PROTO_MINOR }}-${{ env.PROTO_PATCH }}-keyvi
- name: Install Protobuf
if: steps.cache_protobuf.outputs.cache-hit != 'true'
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/google/protobuf/releases/download/v$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH/protobuf-cpp-$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH.tar.gz
tar -zxvf protobuf-cpp-$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH.tar.gz
cd protobuf-$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH
./configure --prefix=$GITHUB_WORKSPACE/protobuf-$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH/installdir
make
make install
- name: build with cmake
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}/protobuf-$PROTO_MAJOR.$PROTO_MINOR.$PROTO_PATCH/installdir -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache'
buildWithCMake: true
buildDirectory: '${{ github.workspace }}/build'
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd python
python -m pip install -r requirements.txt
python -m pip install redis
python setup.py build
python setup.py install --user
python -m pytest tests