forked from konveyor/kai
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 3.66 KB
/
build-and-push-binaries.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
name: Build and Publish Binaries
on:
workflow_dispatch:
inputs:
use_latest_release:
type: boolean
default: true
description: Upload binaries to the most recent release
pattern:
type: string
default: 'v*'
description: Pick from tags matching this pattern
pre_release:
type: boolean
description: Look for pre-release?
default: false
pull_request:
push:
jobs:
e2e_test:
name: Run e2e test
strategy:
matrix:
runs_on:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: cmd
runs-on: ${{ matrix.runs_on.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- id: release_info
uses: joutvhu/get-release@v1
with:
latest: ${{ github.event.inputs.use_latest_release }}
pattern: ${{ github.event.inputs.pattern }}
prerelease: ${{ github.event.inputs.pre_release }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: actions/setup-go@v5
with:
go-version: '1.23'
check-latest: true
- name: Set up venv (windows)
if: matrix.runs_on.os == 'windows-latest'
run: |
python -m venv venv
. venv\Scripts\activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Set up venv (linux & mac)
if: matrix.runs_on.os != 'windows-latest'
run: |
python -m venv venv
. venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Build RPC server
run: |
pip install -r requirements.txt
pip install pyinstaller
pip install -e .
pyinstaller build/build.spec
- name: Build Kai Analyzer
run: |
cd kai-analyzer && go build -ldflags="-extldflags=-static" -o kai-analyzer main.go && cd ..
- name: lowercase runner.os (linux & mac)
if: matrix.runs_on.os != 'windows-latest' && github.event_name == 'workflow_dispatch'
run: |
echo "OS=`echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: lowercase runner.os (windows)
if: matrix.runs_on.os == 'windows-latest' && github.event_name == 'workflow_dispatch'
run: |
$os_string = "${{ runner.os }}"
$lowercase_os_string = $os_string.ToLower()
echo "OS=$lowercase_os_string" >> $env:GITHUB_ENV
- name: Archive binaries (linux & mac)
if: matrix.runs_on.os != 'windows-latest' && github.event_name == 'workflow_dispatch'
run: |
zip -j kai-rpc-server.${{ env.OS }}.zip dist/kai-rpc-server kai-analyzer/kai-analyzer
- name: Archive binaries (windows)
if: matrix.runs_on.os == 'windows-latest' && github.event_name == 'workflow_dispatch'
run: |
mv kai-analyzer\kai-analyzer kai-analyzer\kai-analyzer.exe
$filesToInclude = "dist\kai-rpc-server.exe", "kai-analyzer\kai-analyzer.exe"
Compress-Archive -Path $filesToInclude -Destination kai-rpc-server.${{ env.OS }}.zip
- name: Upload binary
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_info.outputs.upload_url }}
asset_path: kai-rpc-server.${{ env.OS }}.zip
asset_name: kai-rpc-server.${{ env.OS }}.zip
asset_content_type: application/zip