-
Notifications
You must be signed in to change notification settings - Fork 57
125 lines (106 loc) · 3.69 KB
/
build-m1-wheel.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
name: Build M1 Wheels
on:
push:
branches:
- main
- dev
tags:
- '**'
pull_request:
branches:
- '**'
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}--${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheel on Mac M1
runs-on: [m1]
strategy:
fail-fast: false
steps:
- uses: Chia-Network/actions/clean-workspace@main
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
arch -arm64 sh rust.sh -y
- name: Build m1 wheels
run: |
arch -arm64 python3 -m venv venv
. ./venv/bin/activate
export PATH=~/.cargo/bin:$PATH
arch -arm64 pip install maturin
arch -arm64 maturin build -m wheel/Cargo.toml -i python --release --strip --features=openssl
- name: Install clvm_rs wheel
run: |
. ./venv/bin/activate
ls ./target/wheels/
arch -arm64 pip install ./target/wheels/clvm_rs*.whl
- name: Install other wheels
run: |
. ./venv/bin/activate
arch -arm64 python -m pip install pytest
arch -arm64 python -m pip install blspy
- name: install clvm & clvm_tools
run: |
. ./venv/bin/activate
arch -arm64 git clone https://github.com/Chia-Network/clvm.git --branch=main --single-branch
arch -arm64 python -m pip install ./clvm
arch -arm64 git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
arch -arm64 python -m pip install ./clvm_tools
- name: Ensure clvm, clvm_rs, clvm_tools are installed
run: |
. ./venv/bin/activate
arch -arm64 python -c 'import clvm'
arch -arm64 python -c 'import clvm; print(clvm.__file__)'
arch -arm64 python -c 'import clvm_rs; print(clvm_rs.__file__)'
arch -arm64 python -c 'import clvm_tools; print(clvm_tools.__file__)'
- name: Run tests from clvm
run: |
. ./venv/bin/activate
cd clvm
arch -arm64 pytest tests
- name: Run tests from clvm_tools
run: |
. ./venv/bin/activate
cd clvm_tools
arch -arm64 pytest tests
- name: Run tests from wheel
run: |
. ./venv/bin/activate
cd wheel/python
pytest --import-mode append tests
# we use `append` because otherwise the `clvm_rs` source is added
# to `sys.path` and it uses that instead of the wheel (and so
# ignoring `clvm_rs.so`, which is pretty important)
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./target/wheels
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo "HAS_SECRET=${HAS_SECRET}" >>$GITHUB_OUTPUT
env:
SECRET: "${{ secrets.test_pypi_password }}"
- name: Install twine
run: |
. ./venv/bin/activate
arch -arm64 pip install twine
- name: Publish distribution to PyPI
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
. ./venv/bin/activate
arch -arm64 twine upload --non-interactive --skip-existing --verbose 'target/wheels/*'