Skip to content

Sync with aosp/main #93

Sync with aosp/main

Sync with aosp/main #93

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 --version 0.2.2
- name: Build
run: |
bazel build :rootcanal
bazel build :librootcanal_ffi.so
- name: Package Artifacts
run: |
mkdir -p rootcanal-${{ matrix.release }}/bin
mkdir -p rootcanal-${{ matrix.release }}/lib
mkdir -p rootcanal-${{ matrix.release }}/include
cp bazel-bin/rootcanal rootcanal-${{ matrix.release }}/bin
cp bazel-bin/librootcanal_ffi.so rootcanal-${{ matrix.release }}/lib
cp model/controller/ffi.h rootcanal-${{ matrix.release }}/include/rootcanal_ffi.h
zip -r rootcanal-${{ matrix.release }} rootcanal-${{ matrix.release }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: rootcanal-${{ matrix.release }}
path: rootcanal-${{ matrix.release }}.zip
retention-days: 1
release:
name: Release
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
cargo install pdl-compiler --version 0.2.2
python3 -m pip install hatch
- name: Set VERSION
run: |
TAG=${{ github.ref_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- 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: Build Python Wheel
run: bash py/make_wheel.sh ${{ env.VERSION }}
- name: Upload Python Wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: py/dist/rootcanal-${{ env.VERSION }}-py3-none-any.whl
asset_name: rootcanal-${{ env.VERSION }}-py3-none-any.whl
asset_content_type: application/x-wheel+zip
- 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-${{ env.VERSION }}-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-${{ env.VERSION }}-macos-x86_64.zip
asset_content_type: application/zip