-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add k230_flash_cli build * Bump to v0.0.3
- Loading branch information
1 parent
ae39ba3
commit 25147dd
Showing
10 changed files
with
253 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: Cli-Build | ||
|
||
on: | ||
push: | ||
tags: [ "v*" ] | ||
branches: [ "dev", "test/*"] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
concurrency: | ||
group: Cli-Build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-cli-windows: | ||
name: build-cli-windows | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.repository }}-${{ github.workflow }}-Windows | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Get Git revision and set as environment variable | ||
id: get_revision | ||
run: | | ||
revision=$(git describe --long --tag --dirty --always) | ||
echo "REVISION=$revision" >> $GITHUB_ENV | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Pull Docker image | ||
run: | | ||
docker pull mstorsjo/llvm-mingw | ||
- name: Build K230 Cli for Windows | ||
run: | | ||
rm -rf ${{ github.workspace }}/build && mkdir -p ${{ github.workspace }}/build | ||
docker run --name llvm_mingw -v "${PWD}:/project:ro" mstorsjo/llvm-mingw /bin/bash -c 'cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/build/dist -DBUILD_WITH_MINGW=ON -DCMAKE_TOOLCHAIN_FILE=/project/src/kburn/cli/cmake/mingw-toolchain.cmake -S /project/src/kburn -B /build; cmake --build /build --config Release; cmake --install /build --prefix /build/dist' | ||
docker cp llvm_mingw:/build/dist ${{ github.workspace }}/dist | ||
docker rm llvm_mingw | ||
ls -alh ${{ github.workspace }}/dist | ||
- name: Compress artifacts | ||
run: | | ||
cd ${{ github.workspace }}/dist/bin | ||
zip -r K230FlahsCli-Windows-${{ env.REVISION }}.zip * | ||
- name: Upload k230_flash-cli Build Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "K230FlahsCli-Windows-${{ env.REVISION }}" | ||
path: ${{ github.workspace }}/dist/bin/K230FlahsCli-Windows-${{ env.REVISION }}.zip | ||
if-no-files-found: error | ||
|
||
build-cli-liunx: | ||
name: build-cli-liunx | ||
runs-on: ubuntu-20.04 | ||
concurrency: | ||
group: ${{ github.repository }}-${{ github.workflow }}-Liunx | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Get Git revision and set as environment variable | ||
id: get_revision | ||
run: | | ||
revision=$(git describe --long --tag --dirty --always) | ||
echo "REVISION=$revision" >> $GITHUB_ENV | ||
- name: Install Depencies | ||
run: | | ||
sudo apt update && sudo apt install -y libudev-dev | ||
- name: Build for Linux | ||
run: | | ||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/dist -S ${{ github.workspace }}/src/kburn -B ${{ github.workspace }}/build | ||
cmake --build ${{ github.workspace }}/build --config Release | ||
cmake --install ${{ github.workspace }}/build --prefix ${{ github.workspace }}/build/dist | ||
- name: Compress artifacts | ||
run: | | ||
cd ${{ github.workspace }}/build/dist | ||
zip -r K230FlahsCli-Linux-${{ env.REVISION }}.zip * | ||
- name: Upload k230_flash-cli Build Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "K230FlahsCli-Linux-${{ env.REVISION }}" | ||
path: ${{ github.workspace }}/build/dist/K230FlahsCli-Linux-${{ env.REVISION }}.zip | ||
if-no-files-found: error | ||
|
||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: [build-cli-windows, build-cli-liunx] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: ./release | ||
|
||
- name: List Release Directory | ||
run: ls -R ./release | ||
|
||
- name: Upload Release Assets | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
generate_release_notes: true | ||
tag_name: ${{ github.ref_name }} | ||
files: | | ||
./release/**/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit immediately if a command exits with a non-zero status. | ||
|
||
OUTPUT_EXE_NAME="$1" # The first argument is the output executable name. | ||
TOOLCHAIN_ROOT="$2" # The second argument is the toolchain root directory. | ||
INSTALL_PREFIX="$3" # The third argument is the install prefix. | ||
OBJDUMP_COMMAND="$4" # The fourth argument is the objdump command. | ||
|
||
# Check if the required arguments are provided | ||
if [ -z "$OUTPUT_EXE_NAME" ] || [ -z "$TOOLCHAIN_ROOT" ] || [ -z "$INSTALL_PREFIX" ] || [ -z "$OBJDUMP_COMMAND" ]; then | ||
echo "Usage: $0 <output_exe_name> <toolchain_root> <install_prefix> <objdump_command>" | ||
exit 1 | ||
fi | ||
|
||
# Extract DLL names using objdump | ||
DLL_NAMES=$($OBJDUMP_COMMAND -p "$INSTALL_PREFIX/bin/$OUTPUT_EXE_NAME.exe" | grep "DLL Name" | awk '{print $3}') | ||
|
||
# Check if DLL_NAMES is empty | ||
if [ -z "$DLL_NAMES" ]; then | ||
echo "No DLL names found for $OUTPUT_EXE_NAME." | ||
exit 1 | ||
fi | ||
|
||
# Skip specific DLLs and copy the rest | ||
for DLL in $DLL_NAMES; do | ||
case "$DLL" in | ||
"libunwind.dll" | "libc++.dll") | ||
FOUND_DLL=$(find "$TOOLCHAIN_ROOT" -name "$DLL" 2>/dev/null) | ||
if [ -n "$FOUND_DLL" ]; then | ||
echo "Copying DLL: $FOUND_DLL to $INSTALL_PREFIX/bin" | ||
cp "$FOUND_DLL" "$INSTALL_PREFIX/bin" | ||
else | ||
echo "Error: Required DLL not found: $DLL" | ||
exit 1 | ||
fi | ||
;; | ||
*) | ||
echo "Skipping DLL: $DLL" | ||
;; | ||
esac | ||
done | ||
|
||
echo "All required DLLs have been copied." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# mingw-toolchain.cmake | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
|
||
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) | ||
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | ||
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) | ||
set(OBJDUMP_COMMAND x86_64-w64-mingw32-objdump) | ||
|
||
set(CMAKE_FIND_ROOT_PATH /opt/llvm-mingw) | ||
set(TOOLCHAIN_ROOT /opt/llvm-mingw/x86_64-w64-mingw32/bin) | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters