-
Notifications
You must be signed in to change notification settings - Fork 147
115 lines (102 loc) · 4.41 KB
/
concrete_python_test_macos.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: concrete-python tests macos
on:
workflow_dispatch:
pull_request:
path:
- .github/workflows/concrete_python_tests_macos.yml
push:
branches:
- 'main'
- 'release/*'
concurrency:
group: concrete_python_tests_macos_${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
concrete-python-test-pytest:
strategy:
fail-fast: false
matrix:
machine: ["aws-mac1-metal", "aws-mac2-metal"]
runs-on: ${{ matrix.machine }}
steps:
- name: Checkout concrete
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
fetch-depth: 0
- name: Install build dependencies
run: |
brew install ninja ccache
- name: Setup rust toolchain for concrete-cpu
uses: ./.github/workflows/setup_rust_toolchain_for_concrete_cpu
- name: Cache compilation (push)
if: github.event_name == 'push'
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ runner.os }}-${{ runner.arch }}-compilation-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-compilation-cache-
- name: Cache compilation (pull_request)
if: github.event_name == 'pull_request'
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ runner.os }}-${{ runner.arch }}-compilation-cache-${{ github.event.pull_request.base.sha }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-compilation-cache-
- name: Prepare build environment
run: |
set -e
cd $GITHUB_WORKSPACE/frontends/concrete-python
# Setup pkg-config to find OpenBLAS (scipy need it)
export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"
rm -rf .venv
python3.10 -m venv .venv
. $GITHUB_WORKSPACE/frontends/concrete-python/.venv/bin/activate
pip install -r requirements.dev.txt
pip install -r requirements.txt
cd $GITHUB_WORKSPACE/compilers/concrete-compiler/compiler
ccache -z
make Python3_EXECUTABLE=$(which python) python-bindings
ccache -s
export COMPILER_BUILD_DIRECTORY=$GITHUB_WORKSPACE/compilers/concrete-compiler/compiler/build
cd $GITHUB_WORKSPACE/frontends/concrete-python
rm -rf dist && mkdir -p dist
pip wheel -v --no-deps -w dist .
delocate-wheel -v dist/*macos*.whl
deactivate
- name: Prepare test environment
run: |
set -e
export TEST_TMP_DIR=$(mktemp -d)
echo "TEST_TMP_DIR=$TEST_TMP_DIR" >> "${GITHUB_ENV}"
cd $TEST_TMP_DIR
python3.10 -m venv .testenv
. .testenv/bin/activate
pip install $GITHUB_WORKSPACE/frontends/concrete-python/dist/*macos*.whl
pip install -r $GITHUB_WORKSPACE/frontends/concrete-python/requirements.dev.txt
# MacOS x86 have conflict between our OpenMP library, and one from torch
# we fix it by using a single one (from torch)
# see discussion: https://discuss.python.org/t/conflicting-binary-extensions-in-different-packages/25332/8
find .testenv/lib/python3.10/site-packages -not \( -path .testenv/lib/python3.10/site-packages/concrete -prune \) -name 'lib*omp5.dylib' -or -name 'lib*omp.dylib' | xargs -n 1 ln -f -s $(pwd)/.testenv/lib/python3.10/site-packages/concrete/.dylibs/libomp.dylib
cp -R $GITHUB_WORKSPACE/frontends/concrete-python/examples ./examples
cp -R $GITHUB_WORKSPACE/frontends/concrete-python/tests ./tests
cp $GITHUB_WORKSPACE/frontends/concrete-python/Makefile .
- name: Run pytest-macos
run: |
set -e
cd $TEST_TMP_DIR && . .testenv/bin/activate
echo "DEBUG: Rust versions"
cargo --version
rustc --version
KEY_CACHE_DIRECTORY=./KeySetCache PYTEST_MARKERS="not dataflow and not graphviz" make pytest-macos
- name: Run test-notebooks
run: |
set -e
cd $TEST_TMP_DIR && . .testenv/bin/activate
make test-notebooks
- name: Cleanup host
if: success() || failure()
run: |
rm -rf $TEST_TMP_DIR