-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (74 loc) · 3.1 KB
/
build-and-test.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
85
86
87
name: Build and test binding modules
on:
push:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
env:
BAZEL_VERSION: 4.0.0
TENSORFLOW_VERSION: 2.5.0
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
include:
- os: macos-latest
bazel-target: darwin
- os: ubuntu-latest
bazel-target: linux
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} for Linux
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up bazel
run: |
curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh
chmod +x bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh
if [[ "${{ matrix.os }}" == "macos-latest" ]] ; then
(echo "===== Bazel installation Attempt: 1 ====" && ./bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh --user) ||
(echo "===== Bazel installation Attempt: 2 ====" && ./bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh --user) ||
(echo "===== Bazel installation Attempt: 3 ====" && ./bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh --user) ||
(echo "===== Bazel installation Step Failed ====" && exit 1);
else
./bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh --user;
fi
export PATH="$PATH:$HOME/bin"
rm bazel-${BAZEL_VERSION}-installer-${{ matrix.bazel-target }}-x86_64.sh
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install tensorflow-cpu==${TENSORFLOW_VERSION}
- name: Set up workspace
run: ./tf_configure.sh
- name: Build and test python binding
run: |
bazel build -s //python/mecab:test_mecab --verbose_failures
./bazel-bin/python/mecab/test_mecab
- name: Build python binding pip pkg and test
run: |
bazel build -s //python:build_pip_pkg --verbose_failures
./bazel-bin/python/build_pip_pkg artifacts
# TODO: cannot install wheel file in MacOS 10.15.
# This problem will be fixed on BigSur, but want to fix it.
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]] ; then
pip install artifacts/mecab_bind-*
python -c 'import mecab'
mecab --help
fi
- name: Build and test tensorflow binding
run: |
bazel build -s //tf_ops/mecab_tf:mecab_ops_py_test --verbose_failures
./bazel-bin/tf_ops/mecab_tf/mecab_ops_py_test
- name: Build tensorflow binding pip pkg and test
run: |
bazel build -s //tf_ops:build_pip_pkg --verbose_failures
./bazel-bin/tf_ops/build_pip_pkg artifacts
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]] ; then
pip install artifacts/mecab_tf-*
python -c 'import mecab_tf'
fi