From 5eb4f9e78debd6ad1aae478e6f8c531844767271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 14 Dec 2023 03:03:25 +0100 Subject: [PATCH] wip --- .github/workflows/check.yml | 8 +--- .github/workflows/release.yml | 78 ++++++++++++++++++++++++++++++++--- compile/build.sh | 7 ---- compile/bundle.sh | 26 ------------ compile/environment.sh | 26 ------------ compile/sdl.sh | 15 ------- 6 files changed, 73 insertions(+), 87 deletions(-) delete mode 100755 compile/build.sh delete mode 100755 compile/bundle.sh delete mode 100755 compile/environment.sh delete mode 100755 compile/sdl.sh diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f307d85..c58a67e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,13 +26,7 @@ jobs: - name: Get SDL2 run: | - echo "matrix: $MATRIX_OS" - echo "matrix: ${{ matrix.os }}" - - echo "runner: $RUNNER_OS" - echo "runner: ${{ runner.os }}" - - if [ $MATRIX_OS == "ubuntu-latest" ]; then + if [ ${{ matrix.os }} == "ubuntu-latest" ]; then sudo apt install -y libsdl2-dev elif [ ${{ matrix.os }} == "macos-latest" ]; then brew install SDL2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd2b6b8..880130d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,17 +25,83 @@ jobs: restore-keys: | ${{ runner.os }}-build- + - name: Get SDL2 + run: | + if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + sudo apt install -y libsdl2-dev + elif [ ${{ matrix.os }} == "macos-latest" ]; then + brew install SDL2 + elif [ ${{ matrix.os }} == "windows-latest" ]; then + cp include/windows/* . + fi + - name: Set environment - run: ./compile/environment.sh + run: | + if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + PLATFORM=ubuntu + elif [ ${{ matrix.os }} == "macos-latest" ]; then + PLATFORM=macos-x86_64 + elif [ ${{ matrix.os }} == "windows-latest" ]; then + PLATFORM=windows + fi - - name: Get SDL2 - run: ./compile/sdl.sh - + if [ ${{ matrix.os }} == "windows-latest" ]; then + EXT=.exe + OUT_EXT=.exe + else + EXT= + OUT_EXT=.tar.gz + fi + + BUNDLE_NAME=kalast-$GITHUB_REF_NAME-$PLATFORM + RELEASE_FILE=$BUNDLE_NAME$OUT_EXT + + echo $PLATFORM + echo $EXT + echo $OUT_EXT + echo $BUNDLE_NAME + echo $RELEASE_FILE + + echo "PLATFORM=$PLATFORM" >> "$GITHUB_ENV" + echo "EXT=$EXT" >> "$GITHUB_ENV" + echo "OUT_EXT=$OUT_EXT" >> "$GITHUB_ENV" + echo "BUNDLE_NAME=$BUNDLE_NAME" >> "$GITHUB_ENV" + echo "RELEASE_FILE=$RELEASE_FILE" >> "$GITHUB_ENV" + - name: Build - run: ./compile/build.sh + run: | + echo "Build main executable." + cargo build -r --all-features && strip target/release/kalast + + echo "Build custom executable for specific example." + cargo build -r --all-features --example viewer-picker && strip target/release/examples/viewer-picker - name: Bundle - run: ./compile/bundle.sh + run: | + mkdir -p bundle + cp -r examples bundle + cp target/release/kalast$EXT bundle + cp target/release/examples/viewer-picker$EXT bundle/examples/viewer-picker + cp include/kalast.ico bundle + cp -r include/assets bundle + cp preferences.yaml bundle + cp README.md bundle + + if [ ${{ matrix.os }} == "windows-latest" ]; then + cp include/windows/* bundle + fi + + cd bundle + cp -r examples/viewer/cfg . + + cd .. + mv bundle $BUNDLE_NAME + + if [ ${{ matrix.os }} == "windows-latest" ]; then + iscc compile/installer.iss /DVERSION=${{ github.ref_name }} /DSETUP_NAME=${{ env.RELEASE_FILE }} /DBUNDLE_PATH=.\bundle /DASSETS_PATH=.\assets + else + tar cvzf $RELEASE_FILE $BUNDLE_NAME + fi - uses: softprops/action-gh-release@v1 with: diff --git a/compile/build.sh b/compile/build.sh deleted file mode 100755 index a8fc1a9..0000000 --- a/compile/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Build main executable." -cargo build -r --all-features && strip target/release/kalast - -echo "Build custom executable for specific example." -cargo build -r --all-features --example viewer-picker && strip target/release/examples/viewer-picker \ No newline at end of file diff --git a/compile/bundle.sh b/compile/bundle.sh deleted file mode 100755 index c31a8a7..0000000 --- a/compile/bundle.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -mkdir -p bundle -cp -r examples bundle -cp target/release/kalast$EXT bundle -cp target/release/examples/viewer-picker$EXT bundle/examples/viewer-picker -cp include/kalast.ico bundle -cp -r include/assets bundle -cp preferences.yaml bundle -cp README.md bundle - -if [ ${{ matrix.os }} == "windows-latest" ]; then - cp include/windows/* bundle -fi - -cd bundle -cp -r examples/viewer/cfg . - -cd .. -mv bundle $BUNDLE_NAME - -if [ ${{ matrix.os }} == "windows-latest" ]; then - iscc compile/installer.iss /DVERSION=${{ github.ref_name }} /DSETUP_NAME=${{ env.RELEASE_FILE }} /DBUNDLE_PATH=.\bundle /DASSETS_PATH=.\assets -else - tar cvzf $RELEASE_FILE $BUNDLE_NAME -fi \ No newline at end of file diff --git a/compile/environment.sh b/compile/environment.sh deleted file mode 100755 index 3f4a103..0000000 --- a/compile/environment.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - echo "PLATFORM=ubuntu" >> "$GITHUB_ENV" -elif [ ${{ matrix.os }} == "macos-latest" ]; then - echo "PLATFORM=macos-x86_64" >> "$GITHUB_ENV" -elif [ ${{ matrix.os }} == "windows-latest" ]; then - echo "PLATFORM=windows" >> "$GITHUB_ENV" -fi - -if [ ${{ matrix.os }} == "windows-latest" ]; then - echo "EXT=.exe" >> "$GITHUB_ENV" - echo "OUT_EXT=.exe" >> "$GITHUB_ENV" -else - echo "EXT=" >> "$GITHUB_ENV" - echo "OUT_EXT=.tar.gz" >> "$GITHUB_ENV" -fi - -echo "BUNDLE_NAME=kalast-$GITHUB_REF_NAME-$PLATFORM" >> "$GITHUB_ENV" -echo "RELEASE_FILE=$BUNDLE_NAME$OUT_EXT" >> "$GITHUB_ENV" - -echo $PLATFORM -echo $EXT -echo $OUT_EXT -echo $BUNDLE_NAME -echo $RELEASE_FILE \ No newline at end of file diff --git a/compile/sdl.sh b/compile/sdl.sh deleted file mode 100755 index 5690b72..0000000 --- a/compile/sdl.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo "matrix: $MATRIX_OS" -echo "matrix: ${{ matrix.os }}" - -echo "runner: $RUNNER_OS" -echo "runner: ${{ runner.os }}" - -if [ $MATRIX_OS == "ubuntu-latest" ]; then - sudo apt install -y libsdl2-dev -elif [ ${{ matrix.os }} == "macos-latest" ]; then - brew install SDL2 -elif [ ${{ matrix.os }} == "windows-latest" ]; then - cp include/windows/* . -fi \ No newline at end of file