Skip to content

Build the Rootcanal pypi package #15

Build the Rootcanal pypi package

Build the Rootcanal pypi package #15

Workflow file for this run

name: Build and release
on:
pull_request:
workflow_dispatch:
push:
tags:
- 'v*'
branches:
- main
jobs:
build:
name: Build
strategy:
matrix:
include:
- os: ubuntu-latest
release: linux-x86_64
- os: macos-latest
release: macos-x86_64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
cargo install pdl-compiler
python3 -m pip install hatch
- name: Build
run: |
bazel build :rootcanal
bazel build :librootcanal_ffi.so
- name: Package Artifacts
run: |
mkdir -p bin
mkdir -p lib
mkdir -p include
cp bazel-bin/rootcanal bin
cp bazel-bin/librootcanal_ffi.so lib
cp model/controller/ffi.h include/rootcanal_ffi.h
zip -r rootcanal-${{ matrix.release }} \
bin/rootcanal \
lib/librootcanal_ffi.so \
include/rootcanal_ffi.h
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: rootcanal-${{ matrix.release }}
path: rootcanal-${{ matrix.release }}.zip
retention-days: 1
- name: Build Python Wheel
if: github.ref_type == 'tag'
run: |
bash py/make_wheels.sh ${{ github.ref_name }}
- name: Upload Python Wheel
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v3
with:
name: rootcanal-${{ github.ref_name }}-py3-none-${{ matrix.release }}.whl
path: py/dist/*.whl
retention-days: 1
release:
name: Release
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: RootCanal ${{ github.ref_name }}
draft: true
prerelease: false
- name: Download rootcanal-linux-x86_64
uses: actions/download-artifact@v3
with:
name: rootcanal-linux-x86_64
- name: Download rootcanal-macos-x86_64
uses: actions/download-artifact@v3
with:
name: rootcanal-macos-x86_64
- name: Upload rootcanal-linux-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: rootcanal-linux-x86_64.zip
asset_name: rootcanal-${{ github.ref_name }}-linux-x86_64.zip
asset_content_type: application/zip
- name: Upload rootcanal-macos-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: rootcanal-macos-x86_64.zip
asset_name: rootcanal-${{ github.ref_name }}-macos-x86_64.zip
asset_content_type: application/zip