-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- building wheels with bazel - support for macOS via not standard array_record library - support for ci tagging and versioning
- Loading branch information
Showing
32 changed files
with
1,408 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
common --enable_bzlmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build and Save Python Wheel | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' # Build on all branches | ||
tags: | ||
- 'v*' # Trigger the release workflow only when a tag is pushed (e.g., v1.0.0) | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] # Specify both macOS and Linux environments | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Ensures that the full history is cloned to handle any branch-specific build needs | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools wheel | ||
# Run the build script and capture the output directory | ||
- name: Run build script | ||
id: build | ||
run: | | ||
bazel run //:requirements.update | ||
bazel build ... | ||
- name: Run Bazel Tests | ||
run: | | ||
bazel test ... | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: built-wheels-${{ matrix.os }} | ||
path: bazel-bin/*.whl | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/v') # Only run this job if a tag starting with "v" is pushed | ||
steps: | ||
- name: Download Artifacts from macOS | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: built-wheels-macos-latest | ||
path: ./artifacts/macos | ||
|
||
- name: Download Artifacts from Linux | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: built-wheels-ubuntu-latest | ||
path: ./artifacts/linux | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ github.ref_name }} # Use the current tag name as the release version | ||
files: | | ||
artifacts/macos/*.whl | ||
artifacts/linux/*.whl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Byte-compiled files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
*.egg-info/ | ||
dist/ | ||
build/ | ||
eggs/ | ||
*.egg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Virtual environments | ||
*.env | ||
*.venv | ||
|
||
# PyInstaller | ||
*.manifest | ||
*.spec | ||
|
||
# Unit test / coverage reports | ||
*.cover | ||
*.py,cover | ||
.cache | ||
coverage.* | ||
.tox/ | ||
nosetests.xml | ||
*.log | ||
|
||
# Pytest | ||
.pytest_cache/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
dmypy.json | ||
dmypy.json.* | ||
|
||
# Pyre | ||
.pyre/ | ||
|
||
# Jupyter Notebook checkpoints | ||
.ipynb_checkpoints | ||
|
||
# VSCode settings | ||
.vscode/ | ||
|
||
# IDE directories | ||
.idea/ | ||
*.iml | ||
|
||
# Sublime Text project files | ||
*.sublime-project | ||
*.sublime-workspace | ||
|
||
# macOS files | ||
.DS_Store | ||
|
||
# Windows files | ||
Thumbs.db | ||
# Bazel directories | ||
bazel-* | ||
|
||
# Bazel outputs | ||
bazel-bin/ | ||
bazel-out/ | ||
bazel-testlogs/ | ||
bazel-genfiles/ | ||
|
||
# Bazel caches | ||
bazel-cache/ | ||
bazel-workspace/ | ||
.bazelrc.user | ||
.bazelignore | ||
*.bazelproject | ||
|
||
# Bazel module files | ||
modules/ | ||
bazel.lock | ||
bazel_external/ | ||
bazel_dep_graph.dot | ||
|
||
# Build outputs | ||
build/ | ||
dist/ | ||
out/ | ||
|
||
# Temporary files | ||
*.log | ||
*.tmp | ||
*.temp | ||
*.swp | ||
*.bak | ||
|
||
# IDE settings | ||
.idea/ | ||
.project | ||
*.iml | ||
.vscode/ | ||
|
||
# Operating system files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# C++ build artifacts (if you have native rules) | ||
*.o | ||
*.obj | ||
*.exe | ||
*.dll | ||
*.dylib | ||
*.so | ||
|
||
# Python build artifacts (if you use py_rules) | ||
__pycache__/ | ||
*.py[cod] | ||
*.pyo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module( | ||
name = "grain", | ||
version = "0.1.0", | ||
) | ||
|
||
bazel_dep(name = "rules_python", version = "0.36.0") | ||
bazel_dep(name = "pybind11_bazel", version = "2.12.0") | ||
bazel_dep(name = "platforms", version = "0.0.10") | ||
|
||
SUPPORTED_PYTHON_VERSIONS = [ | ||
"3.10", | ||
] | ||
DEFAULT_PYTHON_VERSION = SUPPORTED_PYTHON_VERSIONS[-1] | ||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
[ | ||
python.toolchain( | ||
python_version = version, | ||
is_default = version == DEFAULT_PYTHON_VERSION, | ||
) | ||
for version in SUPPORTED_PYTHON_VERSIONS | ||
] | ||
|
||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.parse( | ||
hub_name = "pypi_grain", | ||
python_version = "3.10", | ||
requirements_lock = "//:requirements_lock.txt", | ||
requirements_darwin = "//:requirements_darwin.txt", | ||
requirements_linux = "//:requirements_linux.txt" | ||
) | ||
use_repo(pip, "pypi_grain") |
Oops, something went wrong.