-
Notifications
You must be signed in to change notification settings - Fork 24
174 lines (164 loc) · 5.81 KB
/
processor-release.yml
File metadata and controls
174 lines (164 loc) · 5.81 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: processor-release
on:
release:
types: [created]
jobs:
release:
name: processor release - ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
os: ubuntu
python-version: "3.10"
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
os: ubuntu
python-version: 3.11
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
os: ubuntu
python-version: 3.12
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
os: ubuntu
python-version: 3.13
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
os: ubuntu
python-version: 3.14
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
os: ubuntu
python-version: "3.10"
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
os: ubuntu
python-version: 3.11
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
os: ubuntu
python-version: 3.12
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
os: ubuntu
python-version: 3.13
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
os: ubuntu
python-version: 3.14
- target: aarch64-apple-darwin
runner: macos-14
os: macos
python-version: "3.10"
- target: aarch64-apple-darwin
runner: macos-14
os: macos
python-version: 3.11
- target: aarch64-apple-darwin
runner: macos-14
os: macos
python-version: 3.12
- target: aarch64-apple-darwin
runner: macos-14
os: macos
python-version: 3.13
- target: aarch64-apple-darwin
runner: macos-14
os: macos
python-version: 3.14
env:
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: update apt cache on linux
if: matrix.os == 'ubuntu'
run: sudo apt-get update
- name: install protoc linux
if: matrix.os == 'ubuntu'
run: sudo apt-get install -y protobuf-compiler
- name: install protoc macos
if: matrix.os == 'macos'
run: brew install protobuf
- name: update python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set build env
run: echo "BUILD_SHORT_SHA=$(echo -n $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
rustflags: ""
- uses: taiki-e/install-action@nextest
- name: run test processor-sdk
uses: actions-rs/cargo@v1
with:
command: nextest
args: run --manifest-path ./rotel_python_processor_sdk/Cargo.toml --target ${{ matrix.target }}
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features pyo3 --locked --target ${{ matrix.target }}
- name: upload build
if: matrix.python-version == '3.14'
uses: actions/upload-artifact@v4
with:
name: rotel-processor-build-${{ matrix.target }}
path: target/
- name: tar
run: tar --directory=target/${{ matrix.target }}/release -czf archive.tar.gz rotel
- name: upload
env:
REF_NAME: ${{ github.event.release.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
id=$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/releases/tags/${REF_NAME} --jq .id)
curl --fail-with-body -sS -X POST --data-binary @"archive.tar.gz" -H 'Content-Type: application/octet-stream' -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://uploads.github.com/repos/${{ github.repository }}/releases/$id/assets?name=rotel_py_processor_${{matrix.python-version}}_${REF_NAME}_${{ matrix.target }}.tar.gz"
docker-push:
name: docker push
runs-on: ubuntu-latest
needs: [ release ]
steps:
- uses: actions/checkout@v4
- name: download rotel builds
uses: actions/download-artifact@v4
with:
pattern: rotel-processor-build-*
merge-multiple: true
path: target
- name: Position binaries by docker arch name
run: |
mkdir -p target/amd64 && cp target/x86_64-unknown-linux-gnu/release/rotel target/amd64/ && \
mkdir -p target/arm64 && cp target/aarch64-unknown-linux-gnu/release/rotel target/arm64/
# configure build / push targets
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
streamfold/rotel-python-processors
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.python-processor
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}