Skip to content

🌱 corrected artifact path on PRs #124

🌱 corrected artifact path on PRs

🌱 corrected artifact path on PRs #124

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: macos-13
shell: bash
- os: windows-latest
shell: cmd
models:
- provider: ChatIBMGenAI
model_id: meta-llama/llama-3-70b-instruct
max_new_tokens: 2048
runs-on: ${{ matrix.runs_on.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: "oracle"
java-version: "17"
- 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 pyinstaller
pip install -e .
pip install -r requirements.txt
pyinstaller build/build.spec
env:
PATH: ${{ env.PATH }}
- name: Build Kai Analyzer
run: |
cd kai_analyzer_rpc && go build -ldflags="-extldflags=-static" -o kai-analyzer-rpc main.go && cd ..
- name: Setup analysis deps
if: matrix.runs_on.os == 'ubuntu-latest'
run: |
cp ./dist/kai-rpc-server ./example/analysis/
cp ./kai_analyzer_rpc/kai-analyzer-rpc ./example/analysis/
docker run -d --name=bundle quay.io/konveyor/jdtls-server-base:latest
docker cp bundle:/usr/local/etc/maven.default.index ./example/analysis
docker cp bundle:/jdtls ./example/analysis
docker cp bundle:/jdtls/java-analyzer-bundle/java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar ./example/analysis/bundle.jar
docker cp bundle:/usr/local/etc/maven.default.index ./example/analysis
git config --global user.email "[email protected]"
git config --global user.name "Konveyor CI"
git clone https://github.com/konveyor/rulesets
mv ./rulesets/default/generated ./example/analysis/rulesets
cat << EOF > ./example/config.toml
[models]
provider = "${{ matrix.models.provider }}"
[models.args]
model_id = "${{ matrix.models.model_id }}"
EOF
if [[ -n "${{ matrix.models.max_new_tokens }}" ]]; then
cat << EOF >> ./example/config.toml
parameters.max_new_tokens = ${{ matrix.models.max_new_tokens }}
EOF
fi
- name: Run e2e test
if: matrix.runs_on.os == 'ubuntu-latest'
run: |
which python
cd example
./fetch.sh
./run_demo.py
cd coolstore
changed_files_count=$(git diff --name-only | wc -l)
if (( changed_files_count == 26 )); then
echo "Tests failed"
exit 1
else
echo "Tests passed"
fi
env:
PATH: ${{ env.PATH }}
GENAI_KEY: "BWAHAHA"
- name: lowercase runner.os (linux & mac)
if: matrix.runs_on.os != 'windows-latest'
run: |
echo "OS=`echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: lowercase runner.os (windows)
if: matrix.runs_on.os == 'windows-latest'
run: |
$os_string = "${{ runner.os }}"
$lowercase_os_string = $os_string.ToLower()
echo "OS=$lowercase_os_string" >> $env:GITHUB_ENV
- name: Identify OS Arch (linux & mac)
if: matrix.runs_on.os != 'windows-latest'
run: |
echo "OS_ARCH=$(uname -m)" >>${GITHUB_ENV}
- name: Identify OS Arch (windows)
if: matrix.runs_on.os == 'windows-latest'
run: |
echo "OS_ARCH=$(uname -m)" >> $env:GITHUB_ENV
- name: Archive binaries (linux & mac)
if: matrix.runs_on.os != 'windows-latest'
run: |
zip -j kai-rpc-server.${{ env.OS }}-${{ env.OS_ARCH }}.zip dist/kai-rpc-server kai_analyzer_rpc/kai-analyzer-rpc
- name: Archive binaries (windows)
if: matrix.runs_on.os == 'windows-latest'
run: |
mv kai_analyzer_rpc\kai-analyzer-rpc kai_analyzer_rpc\kai-analyzer-rpc.exe
$filesToInclude = "dist\kai-rpc-server.exe", "kai_analyzer_rpc\kai-analyzer-rpc.exe"
Compress-Archive -Path $filesToInclude -Destination kai-rpc-server.${{ env.OS }}-${{ env.OS_ARCH }}.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 }}-${{ env.OS_ARCH }}.zip
asset_name: kai-rpc-server.${{ env.OS }}-${{ env.OS_ARCH }}.zip
asset_content_type: application/zip
- name: Upload binaries as artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: kai-rpc-server.${{ env.OS }}-${{ env.OS_ARCH }}.zip
path: kai-rpc-server.${{ env.OS }}-${{ env.OS_ARCH }}.zip