Skip to content

Commit 232fdbf

Browse files
Add dependencies for multipy runtime build from setup.py. (#186)
Summary: As title, adding dependencies to allow building multipy runtime from setup.py via cmake. Wrapping everything in a venv, with some minor refactors to GH actions. Setup.py invocation is unchanged in this PR. Adding workflow_dispatch to package_unittest as well. Pull Request resolved: #186 Test Plan: Other than dep installs, no functionality change. Reviewed By: d4l3k Differential Revision: D39779116 Pulled By: anirbanr-fb-r2p fbshipit-source-id: a5c2546ce3cf9cad72881b864334f32751145637
1 parent e22a736 commit 232fdbf

File tree

2 files changed

+92
-6
lines changed

2 files changed

+92
-6
lines changed

.github/workflows/package_tests.yaml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
schedule:
1010
- cron: '0 2 * * *' # run at 2 AM UTC
11+
workflow_dispatch:
1112

1213
jobs:
1314
unittest:
@@ -16,36 +17,84 @@ jobs:
1617
python-major-version: [3]
1718
python-minor-version: [7,8,9]
1819
platform: [ubuntu-18.04]
19-
include:
20-
- python-major-version: 3
21-
python-minor-version: 9
22-
platform: macos-latest
20+
# include:
21+
# - python-major-version: 3
22+
# python-minor-version: 9
23+
# platform: macos-latest
2324
fail-fast: false
2425
runs-on: ${{ matrix.platform }}
2526
steps:
2627
- name: Set Python Version
2728
run: |
2829
echo "python-version=${{ matrix.python-major-version }}.${{ matrix.python-minor-version }}" >> $GITHUB_ENV
30+
2931
- name: Setup Python ${{ env.python-version }}
3032
uses: actions/setup-python@v2
3133
with:
3234
python-version: ${{ env.python-version }}
3335
architecture: x64
36+
3437
- name: Checkout MultiPy
3538
uses: actions/checkout@v2
39+
40+
- name: Install runtime build dependencies
41+
run: |
42+
set -eux
43+
sudo apt update
44+
xargs sudo apt install -y -qq --no-install-recommends <build-requirements.txt
45+
46+
- name: Update cmake
47+
run: |
48+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo gpg --dearmor -o /usr/share/keyrings/magic-key.gpg
49+
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/magic-key.gpg] https://apt.kitware.com/ubuntu/ bionic main" | sudo tee -a /etc/apt/sources.list
50+
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee -a /etc/apt/sources.list
51+
sudo apt update
52+
sudo apt install -y binutils cmake
53+
54+
- name: Set up virtual environment
55+
run: |
56+
set -eux
57+
git submodule update --init --recursive --jobs 0
58+
pip3 install virtualenv
59+
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
60+
export CFLAGS="-fPIC -g"
61+
declare -A py_version_dict
62+
py_version_dict[7]='3.7.10'
63+
py_version_dict[8]='3.8.13'
64+
py_version_dict[9]='3.9.13'
65+
py_version_dict[10]='3.10.6'
66+
py_install_version=${py_version_dict[${{ matrix.python-minor-version }}]}
67+
~/.pyenv/bin/pyenv install --force ${py_install_version}
68+
virtualenv -p ~/.pyenv/versions/${py_install_version}/bin/python3 ~/venvs/multipy
69+
3670
- name: Install dependencies
3771
run: |
3872
set -eux
73+
source ~/venvs/multipy/bin/activate
3974
pip install -r dev-requirements.txt
75+
deactivate
76+
77+
- name: Run setup.py
78+
run: |
79+
set -eux
80+
source ~/venvs/multipy/bin/activate
4081
python setup.py install
82+
deactivate
83+
4184
- name: Run tests
42-
run: coverage run -m unittest discover --verbose --start-directory multipy/test/package/ --pattern "test_*"
85+
run: |
86+
set -eux
87+
source ~/venvs/multipy/bin/activate
88+
coverage run -m unittest discover --verbose --start-directory multipy/test/package/ --pattern "test_*"
89+
deactivate
90+
4391
- name: Coverage
4492
env:
4593
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4694
run: |
4795
set -eux
96+
source ~/venvs/multipy/bin/activate
4897
coverage report -m
4998
coverage xml
50-
5199
codecov
100+
deactivate

build-requirements.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
build-essential
2+
ca-certificates
3+
ccache
4+
curl
5+
wget
6+
git
7+
libjpeg-dev
8+
xz-utils
9+
bzip2
10+
libbz2-dev
11+
liblzma-dev
12+
libreadline6-dev
13+
libexpat1-dev
14+
libgdbm-dev
15+
glibc-source
16+
libgmp-dev
17+
libffi-dev
18+
libgl-dev
19+
ncurses-dev
20+
libncursesw5-dev
21+
libncurses5-dev
22+
gnome-panel
23+
libssl-dev
24+
tcl-dev
25+
tix-dev
26+
libgtest-dev
27+
tk-dev
28+
libsqlite3-dev
29+
zlib1g-dev
30+
llvm
31+
python-openssl
32+
apt-transport-https
33+
ca-certificates
34+
gnupg
35+
software-properties-common
36+
python-pip
37+
python3-pip

0 commit comments

Comments
 (0)