Skip to content

Commit 68bb02f

Browse files
authored
Build process (#601)
1 parent 286d893 commit 68bb02f

File tree

4 files changed

+97
-132
lines changed

4 files changed

+97
-132
lines changed

.github/workflows/build-wheels.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build Wheels
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
required: true
8+
type: string
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- arch: macosx_x86_64
18+
ext: dylib
19+
whl: macosx_10_16_x86_64
20+
- arch: macosx_arm64
21+
ext: dylib
22+
whl: macosx_11_0_arm64
23+
- arch: linux_aarch64
24+
ext: so
25+
whl: manylinux2014_aarch64
26+
- arch: linux_x86_64
27+
ext: so
28+
whl: manylinux2014_x86_64
29+
- arch: musllinux_x86_64
30+
ext: so
31+
whl: musllinux_1_2_x86_64
32+
- arch: linux_armv6l
33+
ext: so
34+
whl: linux_armv6l
35+
- arch: linux_armv6l
36+
ext: so
37+
whl: linux_armv7l
38+
steps:
39+
- name: Checkout Code - Call
40+
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ inputs.branch }}
43+
if: ${{ inputs.branch }}
44+
- name: Checkout Code - Dispatch
45+
uses: actions/checkout@v4
46+
if: ${{ !inputs.branch }}
47+
48+
- name: Setup Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.12"
52+
53+
- name: Install Poetry
54+
uses: snok/install-poetry@v1
55+
56+
- name: Install package
57+
run: poetry install --all-extras
58+
59+
- name: Download binary
60+
run: curl -sL -o src/viam/rpc/libviam_rust_utils.${{ matrix.ext }} https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${{ matrix.arch }}.${{ matrix.ext }}
61+
62+
- name: HACK for arm7l
63+
if: ${{ matrix.whl == 'linux_armv7l' }}
64+
run: echo "This file enables arm7l support. PyPI doesn't allow for packages with the same hash, so this file must be added to differentiate this arm7l package from the arm6l package." > src/viam/arm7l.txt
65+
66+
- name: Build
67+
run: poetry build -f wheel
68+
69+
- name: Rename
70+
run: |
71+
echo "WHL_NAME=viam_sdk-$(poetry run python -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl" >> $GITHUB_ENV
72+
mv dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(poetry run python -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl
73+
74+
- name: Upload artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: ${{ env.WHL_NAME }}
78+
path: dist/${{ env.WHL_NAME }}

.github/workflows/release-candidate.yml

Lines changed: 10 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
run: poetry install --all-extras
3838

3939
- name: Clean Format Test
40-
run: make clean better_imports format test
40+
run: make clean format typecheck test
4141

4242
- name: Current version
4343
id: current_version
4444
shell: bash
4545
run: |
46-
echo "current_version=$(poetry version)" >> $GITHUB_OUTPUT
46+
echo "current_version=$(poetry version -s)" >> $GITHUB_OUTPUT
4747
4848
- name: Bump Version
4949
id: bump_version
@@ -86,82 +86,27 @@ jobs:
8686
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8787

8888
build:
89+
uses: ./.github/workflows/build-wheels.yml
90+
with:
91+
branch: rc-${{ needs.prepare.outputs.version }}
8992
needs: prepare
9093
if: github.repository_owner == 'viamrobotics'
91-
runs-on: ubuntu-latest
92-
strategy:
93-
matrix:
94-
include:
95-
- arch: macosx_x86_64
96-
ext: dylib
97-
whl: macosx_10_16_x86_64
98-
- arch: macosx_arm64
99-
ext: dylib
100-
whl: macosx_11_0_arm64
101-
- arch: linux_aarch64
102-
ext: so
103-
whl: manylinux2014_aarch64
104-
- arch: linux_x86_64
105-
ext: so
106-
whl: manylinux2014_x86_64
107-
- arch: musllinux_x86_64
108-
ext: so
109-
whl: musllinux_1_2_x86_64
110-
- arch: linux_armv6l
111-
ext: so
112-
whl: linux_armv6l
113-
- arch: linux_armv6l
114-
ext: so
115-
whl: linux_armv7l
116-
steps:
117-
- name: Checkout Code
118-
uses: actions/checkout@v4
119-
with:
120-
ref: rc-${{ needs.prepare.outputs.version }}
121-
122-
- name: Setup Python
123-
uses: actions/setup-python@v5
124-
with:
125-
python-version: "3.12"
126-
127-
- name: Install Poetry
128-
uses: snok/install-poetry@v1
129-
130-
- name: Install package
131-
run: poetry install --all-extras
132-
133-
- name: Download binary
134-
run: curl -sL -o src/viam/rpc/libviam_rust_utils.${{ matrix.ext }} https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${{ matrix.arch }}.${{ matrix.ext }}
135-
136-
- name: HACK for arm7l
137-
if: ${{ matrix.whl == 'linux_armv7l' }}
138-
run: echo "This file enables arm7l support. PyPI doesn't allow for packages with the same hash, so this file must be added to differentiate this arm7l package from the arm6l package." > src/viam/arm7l.txt
139-
140-
- name: Build
141-
run: poetry build -f wheel
142-
143-
- name: Rename
144-
run: mv dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-${{ matrix.whl }}.whl
145-
146-
- name: Upload artifacts
147-
uses: actions/upload-artifact@v3
148-
with:
149-
name: dist
150-
path: dist
15194

15295
release:
15396
needs: [prepare, build]
15497
if: github.repository_owner == 'viamrobotics'
15598
runs-on: ubuntu-latest
15699

157100
steps:
158-
- uses: actions/download-artifact@v3
101+
- uses: actions/download-artifact@v4
102+
with:
103+
path: dist
159104

160105
- name: Release
161-
uses: softprops/action-gh-release@v1
106+
uses: softprops/action-gh-release@v2
162107
with:
163108
tag_name: v${{ needs.prepare.outputs.rc_version }}
164-
files: dist/*
109+
files: dist/**
165110
draft: true
166111
prerelease: true
167112
fail_on_unmatched_files: true

.github/workflows/release.yml

Lines changed: 9 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: poetry install --all-extras
2626

2727
- name: Clean Format Test
28-
run: make clean better_imports format test
28+
run: make clean format typecheck test
2929

3030
- name: Bump Version
3131
id: bump_version
@@ -63,82 +63,27 @@ jobs:
6363
pr_body: This is an auto-generated PR to merge the rc branch back into main upon successful release.
6464

6565
build:
66+
uses: ./.github/workflows/build-wheels.yml
67+
with:
68+
branch: rc-${{ needs.prepare.outputs.version }}
6669
needs: prepare
6770
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
68-
runs-on: ubuntu-latest
69-
strategy:
70-
matrix:
71-
include:
72-
- arch: macosx_x86_64
73-
ext: dylib
74-
whl: macosx_10_16_x86_64
75-
- arch: macosx_arm64
76-
ext: dylib
77-
whl: macosx_11_0_arm64
78-
- arch: linux_aarch64
79-
ext: so
80-
whl: manylinux2014_aarch64
81-
- arch: linux_x86_64
82-
ext: so
83-
whl: manylinux2014_x86_64
84-
- arch: musllinux_x86_64
85-
ext: so
86-
whl: musllinux_1_2_x86_64
87-
- arch: linux_armv6l
88-
ext: so
89-
whl: linux_armv6l
90-
- arch: linux_armv6l
91-
ext: so
92-
whl: linux_armv7l
93-
steps:
94-
- name: Checkout Code
95-
uses: actions/checkout@v4
96-
with:
97-
ref: rc-${{ needs.prepare.outputs.version }}
98-
99-
- name: Setup Python
100-
uses: actions/setup-python@v5
101-
with:
102-
python-version: "3.12"
103-
104-
- name: Install Poetry
105-
uses: snok/install-poetry@v1
106-
107-
- name: Install package
108-
run: poetry install --all-extras
109-
110-
- name: Download binary
111-
run: curl -sL -o src/viam/rpc/libviam_rust_utils.${{ matrix.ext }} https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${{ matrix.arch }}.${{ matrix.ext }}
112-
113-
- name: HACK for arm7l
114-
if: ${{ matrix.whl == 'linux_armv7l' }}
115-
run: echo "This file enables arm7l support. PyPI doesn't allow for packages with the same hash, so this file must be added to differentiate this arm7l package from the arm6l package." > src/viam/arm7l.txt
116-
117-
- name: Build
118-
run: poetry build -f wheel
119-
120-
- name: Rename
121-
run: mv dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-${{ matrix.whl }}.whl
122-
123-
- name: Upload artifacts
124-
uses: actions/upload-artifact@v3
125-
with:
126-
name: dist
127-
path: dist
12871

12972
release:
13073
needs: [prepare, build]
13174
if: github.repository_owner == 'viamrobotics' && startsWith(github.ref_name, 'rc-')
13275
runs-on: ubuntu-latest
13376

13477
steps:
135-
- uses: actions/download-artifact@v3
78+
- uses: actions/download-artifact@v4
79+
with:
80+
path: dist
13681

13782
- name: Release
138-
uses: softprops/action-gh-release@v1
83+
uses: softprops/action-gh-release@v2
13984
with:
14085
tag_name: v${{ needs.prepare.outputs.version }}
141-
files: dist/*
86+
files: dist/**
14287
draft: true
14388
prerelease: false
14489
fail_on_unmatched_files: true

.github/workflows/update_protos.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030
env:
3131
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
3232

33-
- name: Generate better imports
34-
run: make better_imports
35-
3633
- name: Format
3734
run: make format
3835

0 commit comments

Comments
 (0)