-
Notifications
You must be signed in to change notification settings - Fork 147
134 lines (119 loc) · 4.84 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: concrete-python tests macos
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/concrete_python_test_macos.yml
push:
branches:
- 'main'
- 'release/*'
concurrency:
group: concrete_python_tests_macos_${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
jobs:
concrete-python-test-pytest:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
machine: ["aws-mac1-metal", "aws-mac2-metal"]
runs-on: ${{ matrix.machine }}
outputs:
slack_message: ${{ steps.prepare_slack_notif.outputs.slack_message }}
slack_color: ${{ steps.prepare_slack_notif.outputs.slack_color }}
env:
python: python${{matrix.python-version}}
concrete-python-dir: ${{ github.workspace }}/frontends/concrete-python
concrete-compiler-dir: ${{ github.workspace }}/compilers/concrete-compiler/compiler
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
fetch-depth: 0
- name: Install build dependencies
run: |
brew install ninja ccache
- name: Setup rust toolchain for concrete-cpu
uses: ./.github/actions/setup_rust_toolchain_for_concrete_cpu
- name: Prepare build environment
run: |
set -e
cd ${{ env.concrete-python-dir }}
# Setup pkg-config to find OpenBLAS (scipy need it)
export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"
rm -rf .venv
${{ env.python }} -m venv .venv
. ${{ env.concrete-python-dir }}/.venv/bin/activate
pip install -r requirements.dev.txt
pip install -r requirements.txt
- name: Build concrete-compiler python-bindings
run: |
. ${{ env.concrete-python-dir }}/.venv/bin/activate
cd ${{ env.concrete-compiler-dir }}
ccache -z
make Python3_EXECUTABLE="$(which ${{ env.python }})" python-bindings
ccache -s
- name: Create wheels
run: |
. ${{ env.concrete-python-dir }}/.venv/bin/activate
cd ${{ env.concrete-python-dir }}
export COMPILER_BUILD_DIRECTORY=${{ env.concrete-compiler-dir }}/build
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
TEST_TMP_DIR=$(mktemp -d)
echo "TEST_TMP_DIR=$TEST_TMP_DIR" >> "${GITHUB_ENV}"
cd "${TEST_TMP_DIR}"
${{ env.python }} -m venv .testenv
. .testenv/bin/activate
pip install ${{ env.concrete-python-dir }}/dist/*macos*.whl
pip install -r ${{ env.concrete-python-dir }}/requirements.dev.txt
${{ github.workspace }}/.github/workflows/scripts/fix_multi_omp_bug_macos.sh
cp -R ${{ env.concrete-python-dir }}/examples ./examples
cp -R ${{ env.concrete-python-dir }}/tests ./tests
cp -R ${{ env.concrete-python-dir }}/scripts ./scripts
cp ${{ env.concrete-python-dir }}/Makefile .
- name: Run pytest-macos
run: |
set -e
cd "${TEST_TMP_DIR}" && . .testenv/bin/activate
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}"
- name: Prepare Slack Notification
id: prepare_slack_notif
if: ${{ failure() }}
continue-on-error: true
run: |
echo "slack_message=concrete-python-test-pytest (${{matrix.machine}}/${{ matrix.python-version }}) finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" >> "$GITHUB_OUTPUT"
echo "slack_color=${{ job.status }}" >> "$GITHUB_OUTPUT"
slack-notif-macos:
needs: ["concrete-python-test-pytest"]
runs-on: "ubuntu-latest"
if: always()
steps:
- name: Slack Notification
# we want to check that prepare_slack_notif was run
if: ${{ needs.concrete-python-test-pytest.outputs.slack_color != '' }}
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990
env:
SLACK_COLOR: ${{ needs.concrete-python-test-pytest.outputs.slack_color }}
SLACK_MESSAGE: ${{ needs.concrete-python-test-pytest.outputs.slack_message }}