-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from inosion/python-support
Python support
- Loading branch information
Showing
39 changed files
with
1,633 additions
and
659 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,264 @@ | ||
# This file is autogenerated by maturin v1.5.1 | ||
# To update, run | ||
# | ||
# maturin generate-ci github | ||
# | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
name: Build | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-linux-amd64-package: | ||
name: Build x86_64 Linux Package | ||
runs-on: ubuntu-latest-xlarge | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup toolchain install nightly --component rustfmt | ||
- run: cargo +nightly fmt --check | ||
- run: cargo install cargo-deb | ||
- run: cargo build --release | ||
- run: cargo deb --no-build --no-strip | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-linux-amd64 | ||
path: target/release/madato | ||
if-no-files-found: error | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-deb-linux-amd64 | ||
path: target/debian/madato_*.deb | ||
if-no-files-found: error | ||
|
||
build-linux-arm64-package: | ||
name: Build Aarch64 Linux Package | ||
runs-on: ubuntu-latest-xlarge | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup toolchain install nightly --component rustfmt | ||
- run: cargo +nightly fmt --check | ||
- run: make package-ui | ||
- run: make build-release-aarch64 | ||
- run: cargo install cargo-deb | ||
- run: cargo deb --no-build --no-strip --target aarch64-unknown-linux-gnu | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-linux-aarch64 | ||
path: target/aarch64-unknown-linux-gnu/release/madato | ||
if-no-files-found: error | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-deb-linux-aarch64 | ||
path: target/aarch64-unknown-linux-gnu/debian/madato_*.deb | ||
if-no-files-found: error | ||
|
||
build-macos-package: | ||
name: Build macOS Package | ||
runs-on: macos-14-xlarge | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup update | ||
- run: rustup toolchain install nightly --component rustfmt | ||
- run: rustup target add aarch64-apple-darwin | ||
- run: cargo +nightly fmt --check | ||
- run: brew install protobuf | ||
- run: make package-ui | ||
- run: cargo build --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-darwin-arm64 | ||
path: target/release/madato | ||
if-no-files-found: error | ||
|
||
build-macos-package-x86: | ||
name: Build macOS Package | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rustup update | ||
- run: rustup toolchain install nightly --component rustfmt | ||
- run: cargo +nightly fmt --check | ||
- run: brew install protobuf | ||
- run: make package-ui | ||
- run: cargo build --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-darwin-amd64 | ||
path: target/release/madato | ||
if-no-files-found: error | ||
|
||
build-windows-package: | ||
name: Build Windows Package | ||
runs-on: windows-latest-large | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ilammy/setup-nasm@v1 | ||
- run: rustup toolchain install nightly --component rustfmt | ||
- run: cargo +nightly fmt --check | ||
- run: choco install protoc | ||
- run: make package-ui | ||
- run: cargo build --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: madato-windows-amd64.exe | ||
path: target/release/madato.exe | ||
if-no-files-found: error | ||
|
||
extract-version: | ||
name: Extract Version Number | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version_extraction.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: version_extraction | ||
run: echo "version=$(cargo metadata --format-version 1 | jq '.packages[] | select(.name == "madato") | .version' | xargs)" >> "$GITHUB_OUTPUT" | ||
|
||
create-release: | ||
name: Create GitHub Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-linux-amd64-package | ||
- build-linux-arm64-package | ||
- build-windows-package | ||
- build-macos-package | ||
- build-macos-package-x86 | ||
- extract-version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: mkdir -p /tmp/release | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/release/ | ||
- name: Name Artifacts | ||
run: | | ||
mv /tmp/release/madato-windows-amd64.exe/madato.exe /tmp/release/madato-${{ needs.extract-version.outputs.version }}-windows-amd64.exe | ||
mv /tmp/release/madato-darwin-arm64/madato /tmp/release/madato-${{ needs.extract-version.outputs.version }}-darwin-arm64 | ||
mv /tmp/release/madato-darwin-amd64/madato /tmp/release/madato-${{ needs.extract-version.outputs.version }}-darwin-amd64 | ||
mv /tmp/release/madato-linux-amd64/madato /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-amd64 | ||
mv /tmp/release/madato-deb-linux-amd64/madato_${{ needs.extract-version.outputs.version }}-1_amd64.deb /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-amd64.deb | ||
mv /tmp/release/madato-deb-linux-aarch64/madato_${{ needs.extract-version.outputs.version }}-1_arm64.deb /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-arm64.deb | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: "v${{ needs.extract-version.outputs.version }}" | ||
prerelease: ${{ github.event.inputs.prerelease }} | ||
body: ${{ github.event.inputs.release_message }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Windows Binary | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-windows-amd64.exe | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-windows-amd64.exe | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Linux Binary | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-amd64 | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-linux-amd64 | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload macOS Binary | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-darwin-arm64 | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-darwin-arm64 | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload macOS x86 Binary | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-darwin-amd64 | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-darwin-amd64 | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Linux Deb Package for amd64 | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-amd64.deb | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-linux-amd64.deb | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Linux Deb Package for arm64 | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/release/madato-${{ needs.extract-version.outputs.version }}-linux-arm64.deb | ||
asset_name: madato-${{ needs.extract-version.outputs.version }}-linux-arm64.deb | ||
asset_content_type: application/octet-stream | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: install reprepro | ||
run: sudo apt-get update && sudo apt-get install -y reprepro | ||
- name: Run reprepro | ||
run: | | ||
ls /tmp/release/ | ||
cd .repo | ||
reprepro includedeb buster /tmp/release/*.deb | ||
reprepro includedeb focal /tmp/release/*.deb | ||
reprepro includedeb jammy /tmp/release/*.deb | ||
- uses: ryand56/r2-upload-action@latest | ||
with: | ||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | ||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | ||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | ||
r2-bucket: ${{ secrets.R2_BUCKET }} | ||
source-dir: .repo | ||
destination-dir: ./repo | ||
|
||
build-and-push-docker-images: | ||
name: Build and Push Docker Images | ||
runs-on: ubuntu-latest | ||
needs: | ||
- extract-version | ||
- create-release | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- run: | | ||
docker buildx build --platform=linux/amd64,linux/arm64 --push . -t tensorlake/madato:latest -t tensorlake/madato:stable -f dockerfiles/Dockerfile.server; | ||
|
||
tag=""; | ||
for i in $(echo ${{ needs.extract-version.outputs.version }} | tr '.' '\n') | ||
do | ||
if [[ $tag == "" ]]; then | ||
tag="$i"; | ||
else | ||
tag="$tag.$i"; | ||
fi | ||
docker buildx build --platform=linux/amd64,linux/arm64 --push . -t tensorlake/madato:$tag -f dockerfiles/Dockerfile.server; | ||
done |
Oops, something went wrong.