-
Notifications
You must be signed in to change notification settings - Fork 5
128 lines (112 loc) · 3.76 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
- 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
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