Skip to content

Commit 307fa64

Browse files
committed
WIP: buf build
1 parent bf48a48 commit 307fa64

File tree

5 files changed

+89
-115
lines changed

5 files changed

+89
-115
lines changed

.github/workflows/build-golang-macos.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: Ubuntu build - buf edition
3+
on: [push]
4+
jobs:
5+
6+
build:
7+
runs-on: ubuntu-22.04
8+
permissions:
9+
contents: write
10+
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
go-version: [1.24.x]
15+
python3_version: [ "3.11", "3.12" ]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: ${{ matrix.go-version }}
24+
cache-dependency-path: go.sum
25+
26+
# - name: Set up Python
27+
# uses: actions/setup-python@v4
28+
# with:
29+
# python-version: ${{ matrix.python3_version }}
30+
31+
- name: Install the latest version of uv
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
version: "latest"
35+
python-version: ${{ matrix.python3_version }}
36+
37+
# Download a release like https://github.com/bufbuild/buf/releases/download/v1.53.0/buf-Linux-x86_64
38+
- name: Install buf
39+
run: |
40+
BUF_VERSION="1.53.0"
41+
BUF_URL="https://github.com/bufbuild/buf/releases/download/v1.53.0/buf-Linux-x86_64"
42+
curl -sSL "$BUF_URL" -o /usr/local/bin/buf
43+
chmod +x /usr/local/bin/buf
44+
45+
- name: Add buf to PATH
46+
run: echo "/usr/local/bin" >> $GITHUB_PATH
47+
48+
- name: Check buf version
49+
run: buf --version
50+
51+
- name: Build using 'uv_buf_build_script.sh'
52+
run: |
53+
cd build-scripts/
54+
chmod +x ./uv_buf_build_script.sh
55+
./uv_buf_build_script.sh

.github/workflows/build-golang-ubuntu.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

build-scripts/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="otdf_python",
5+
version="0.2.11",
6+
author="b-long",
7+
author_email="[email protected]",
8+
description="Buf generated SDK for OpenTDF",
9+
packages=find_packages("gen"),
10+
package_dir={"": "gen"},
11+
)

build-scripts/uv_buf_build_script.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Based on the excellent work of the sift-stack team:
4+
# https://github.com/sift-stack/sift/blob/main/docs/python.md
35
set -x
46
set -eou pipefail
57

@@ -64,3 +66,24 @@ git clone --depth 1 https://github.com/opentdf/platform.git
6466

6567
cd platform || { echo "Unable to change to platform directory" ; exit 1; }
6668
buf export --output=$BUILD_ROOT/protos --config buf.yaml
69+
70+
cd $SCRIPT_DIR || { echo "Unable to change to script directory" ; exit 1; }
71+
cp buf.gen.python.yaml $BUILD_ROOT/buf.gen.yaml
72+
cp setup.py $BUILD_ROOT/setup.py
73+
74+
cd "${BUILD_ROOT}" || { echo "Unable to change to build root directory" ; exit 1; }
75+
buf generate protos || { echo "buf generate failed" ; exit 1; }
76+
77+
for dir in $(find gen -type d); do
78+
touch $dir/__init__.py
79+
done
80+
81+
pip install build protobuf grpcio
82+
python -m build --sdist || { echo "Failed to build source distribution" ; exit 1; }
83+
python -m build --wheel || { echo "Failed to build wheel distribution" ; exit 1; }
84+
85+
echo "Build completed successfully."
86+
echo "Directory contents:"
87+
ls -lart
88+
echo "Dist directory contents:"
89+
ls -lart dist/

0 commit comments

Comments
 (0)