test #4
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
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 }}/build/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 }}/build/dist/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 |