Skip to content

Commit

Permalink
Merge pull request #279 from dora-rs/support-aarch64
Browse files Browse the repository at this point in the history
Release v0.2.3 with aarch64 support
  • Loading branch information
haixuanTao authored May 24, 2023
2 parents 2744799 + 33e12a7 commit 0090331
Show file tree
Hide file tree
Showing 14 changed files with 374 additions and 119 deletions.
158 changes: 129 additions & 29 deletions .github/workflows/pip-release.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,146 @@
name: Pypi Release
# This file has been originally generated by maturin v0.14.17
# To update, you can check
#
# maturin generate-ci github --zig
#
# But note that some manual modification has been done.
# Check the diffs to make sure that you haven't broken anything.

permissions:
contents: write
name: pip-release

on:
release:
types:
- "published"

jobs:
release:
name: "Pypi Release"
permissions:
contents: write

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ubuntu-latest, ubuntu-20.04, macos-latest, windows-latest]
python-version: ["3.7"]
fail-fast: false
runs-on: ${{ matrix.platform }}

target: [x86_64, x86, aarch64]
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]

# Publish Dora Node Python API
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install maturin==0.14
pip install patchelf --upgrade
- name: Publish wheel
shell: bash
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --zig
sccache: "true"
manylinux: auto
working-directory: apis/python/node
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: apis/python/node/dist
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: apis/python/node/dist/*
tag: ${{ github.ref }}
file_glob: true

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: "true"
working-directory: apis/python/node
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: apis/python/node/dist
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: apis/python/node/dist/*
tag: ${{ github.ref }}
file_glob: true

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: "true"
working-directory: apis/python/node
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: apis/python/node/dist
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: apis/python/node/dist/*
tag: ${{ github.ref }}
file_glob: true

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: apis/python/node
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: apis/python/node/dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
cd apis/python/node
maturin publish \
--skip-existing \
-o wheels \
--no-sdist \
--username __token__ \
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASS }}
with:
command: upload
args: --skip-existing *
95 changes: 63 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,39 @@ jobs:
if: runner.os == 'Linux'
run: |
# Publishing those crates from outer crates with no dependency to inner crates
# As cargo is going to rebuild the crates based on published dependencies
# we need to publish those outer crates first to be able to test the publication
# of inner crates.
#
# We should preferably test pre-releases before testing releases as
# cargo publish might catch release issues that the workspace manages to fix using
# workspace crates.
# Publish libraries crates
cargo publish -p dora-message --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-tracing --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-metrics --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-download --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-core --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p communication-layer-pub-sub --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p communication-layer-request-reply --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p shared-memory-server --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish rust API
cargo publish -p dora-operator-api-macros --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-types --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-node-api --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-python --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-c --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-node-api-c --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish binaries crates
cargo publish -p dora-cli --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-coordinator --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-daemon --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publishing those crates from outer crates with no dependency to inner crates
# As cargo is going to rebuild the crates based on published dependencies
# we need to publish those outer crates first to be able to test the publication
# of inner crates.
#
# We should preferably test pre-releases before testing releases as
# cargo publish might catch release issues that the workspace manages to fix using
# workspace crates.
# Publish libraries crates
cargo publish -p dora-message --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-tracing --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-metrics --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-download --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-core --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p communication-layer-pub-sub --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p communication-layer-request-reply --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p shared-memory-server --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish rust API
cargo publish -p dora-operator-api-macros --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-types --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-node-api --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-python --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-operator-api-c --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-node-api-c --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish binaries crates
cargo publish -p dora-cli --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-coordinator --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-runtime --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
cargo publish -p dora-daemon --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: "Create Archive (Unix)"
if: runner.os == 'Linux' || runner.os == 'macOS'
Expand Down Expand Up @@ -95,3 +96,33 @@ jobs:
asset_path: archive.zip
asset_name: dora-${{ github.ref_name }}-x86_64-${{ runner.os }}.zip
asset_content_type: application/zip

- name: "Build Linux ARM64"
if: runner.os == 'Linux'
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target aarch64-unknown-linux-gnu -p dora-coordinator -p dora-cli -p dora-daemon

- name: "Archive Linux ARM64"
if: runner.os == 'Linux'
run: |
mkdir archive_aarch64
cp target/aarch64-unknown-linux-gnu/release/dora-coordinator archive_aarch64
cp target/aarch64-unknown-linux-gnu/release/dora-daemon archive_aarch64
cp target/aarch64-unknown-linux-gnu/release/dora-cli archive_aarch64/dora
cd archive_aarch64
zip -r ../archive_aarch64.zip .
cd ..
- name: "Upload Linux ARM64 asset"
if: runner.os == 'Linux'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: archive_aarch64.zip
asset_name: dora-${{ github.ref_name }}-aarch64-${{ runner.os }}.zip
asset_content_type: application/zip
Loading

0 comments on commit 0090331

Please sign in to comment.