diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12aca9e..742c2a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,404 +14,35 @@ env: TAURI_CLI_VERSION: "1.1.1" jobs: - tauri-build: - strategy: - fail-fast: false - matrix: - platform: [ macos-latest, ubuntu-latest, windows-2022 ] - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - path: ${{ env.SOURCE_PATH }} - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-unknown - components: rustfmt, clippy - override: true - - name: Install aarch64 Darwin - if: runner.os == 'macOS' - run: rustup target add aarch64-apple-darwin - - uses: Swatinem/rust-cache@v1 - with: - working-directory: ${{ env.SOURCE_PATH }} - cache-on-failure: true - key: Trunk_${{ env.TRUNK_VERSION }}-TauriCLI_${{ env.TAURI_CLI_VERSION }} - - name: Install webkit/GTK dependencies (Linux) - if: runner.os == 'Linux' - run: | - sudo apt-get -y update - sudo apt-get -y install libwebkit2gtk-4.0-dev \ - build-essential \ - curl \ - wget \ - libssl-dev \ - libgtk-3-dev \ - libayatana-appindicator3-dev \ - librsvg2-dev - - name: Install Trunk - run: cargo install --locked trunk --version ${{ env.TRUNK_VERSION }} - - name: Install Tauri - run: cargo install tauri-cli --locked --version ${{ env.TAURI_CLI_VERSION }} - - - name: Windows CMD workaround - run: trunk build --release --dist "./../src-tauri/websrc" - if: runner.os == 'Windows' - working-directory: "${{ env.SOURCE_PATH }}/cube_shuffle-wasm" - - name: Tauri Build - run: cargo tauri build ${{ runner.os == 'macOS' && '--target universal-apple-darwin' || '' }} || true - working-directory: "${{ env.SOURCE_PATH }}/src-tauri" - - - uses: actions/upload-artifact@v3 - name: Tauri Linux executable - if: runner.os == 'Linux' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}_EXECUTABLE - path: "${{ env.SOURCE_PATH }}/target/release/cube-shuffle" - - name: Exfiltrate deb - if: runner.os == 'Linux' - run: mv "${{ env.SOURCE_PATH }}/target/release/bundle/deb/cube-shuffle"*".deb" "CubeShuffle-GUI.deb" - - uses: actions/upload-artifact@v3 - name: Tauri Linux deb - if: runner.os == 'Linux' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.deb - path: "CubeShuffle-GUI.deb" - - name: Exfiltrate AppImage - if: runner.os == 'Linux' - run: | - mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage" "CubeShuffle-GUI.AppImage" - mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage.tar.gz" "CubeShuffle-GUI.AppImage.tar.gz" - - uses: actions/upload-artifact@v3 - name: Tauri Linux AppImage - if: runner.os == 'Linux' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.AppImage - path: "CubeShuffle-GUI.AppImage*" - - - name: Exfiltrate MSI - if: runner.os == 'Windows' - run: | - mv "${{ env.SOURCE_PATH }}/target/release/bundle/msi/CubeShuffle*.msi" "./CubeShuffle-GUI.msi" - mv "${{ env.SOURCE_PATH }}/target/release/bundle/msi/CubeShuffle*.msi.zip" "./CubeShuffle-GUI.msi.zip" - - uses: actions/upload-artifact@v3 - name: Tauri Windows Installer - if: runner.os == 'Windows' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.msi - path: "./CubeShuffle-GUI.msi*" - - - name: Exfiltrate macOS app - if: runner.os == 'macOS' - run: mv "${{ env.SOURCE_PATH }}/target/universal-apple-darwin/release/bundle/macos/CubeShuffle.app.tar.gz" "CubeShuffle-GUI.app.tar.gz" - - uses: actions/upload-artifact@v3 - name: Tauri macOS app - if: runner.os == 'macOS' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_Universal.app - path: "CubeShuffle-GUI.app.tar.gz" - - name: Exfiltrate macOS dmg - if: runner.os == 'macOS' - run: mv "${{ env.SOURCE_PATH }}/target/universal-apple-darwin/release/bundle/dmg/CubeShuffle"*".dmg" "./CubeShuffle-GUI.dmg" - - uses: actions/upload-artifact@v3 - name: Tauri macOS dmg - if: runner.os == 'macOS' - with: - if-no-files-found: error - name: CubeShuffle-Tauri_${{ runner.os }}_Universal.dmg - path: "./CubeShuffle-GUI.dmg" - - - name: Cargo build - run: cargo build --verbose --locked --release - working-directory: ${{ env.SOURCE_PATH }} - - name: Clippy - run: cargo clippy --all-features --workspace --all-targets -- -D warnings - working-directory: ${{ env.SOURCE_PATH }} - - name: Run tests - run: cargo test --verbose --locked --release --no-fail-fast - working-directory: ${{ env.SOURCE_PATH }} - - name: Format check - run: cargo fmt --all --check - working-directory: ${{ env.SOURCE_PATH }} + tauri-linux-build: + uses: ./.github/workflows/tauri-linux-build.yml + with: + TRUNK_VERSION: ${ TRUNK_VERSION } + TAURI_CLI_VERSION: ${ TAURI_CLI_VERSION } + + tauri-macos-build: + uses: ./.github/workflows/tauri-macos-build.yml + with: + TRUNK_VERSION: ${ TRUNK_VERSION } + TAURI_CLI_VERSION: ${ TAURI_CLI_VERSION } + + tauri-windows-build: + uses: ./.github/workflows/tauri-windows-build.yml + with: + TRUNK_VERSION: ${ TRUNK_VERSION } + TAURI_CLI_VERSION: ${ TAURI_CLI_VERSION } + + validate: + uses: './.github/workflows/validate.yml' wasm-build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - path: ${{ env.SOURCE_PATH }} - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-unknown - override: true - - uses: Swatinem/rust-cache@v1 - with: - working-directory: ${{ env.SOURCE_PATH }} - cache-on-failure: true - key: Trunk_${{ env.TRUNK_VERSION }} - - name: Install Trunk - run: cargo install --locked trunk --version ${{ env.TRUNK_VERSION }} - - name: Build WASM - run: trunk build --release --dist "${{ github.workspace }}/wasm_build" - working-directory: ${{ env.SOURCE_PATH }}/cube_shuffle-wasm - - name: Upload wasm - uses: actions/upload-artifact@v3 - with: - name: CubeShuffle-wasm - if-no-files-found: error - path: "${{ github.workspace }}/wasm_build" + uses: './.github/workflows/wasm-build.yml' + with: + TRUNK_VERSION: ${ TRUNK_VERSION } cli-build: - strategy: - fail-fast: false - matrix: - target: [ - x86_64-unknown-linux-gnu, - aarch64-unknown-linux-musl, - i686-unknown-linux-gnu, - aarch64-unknown-linux-gnu, - arm-unknown-linux-gnueabi, - arm-unknown-linux-gnueabihf, - armv7-unknown-linux-gnueabihf, - riscv64gc-unknown-linux-gnu, - x86_64-unknown-linux-musl, - - x86_64-pc-windows-msvc, - i686-pc-windows-msvc, - aarch64-pc-windows-msvc, - - x86_64-apple-darwin, - aarch64-apple-darwin, - - x86_64-unknown-netbsd, - ] - include: - - target: x86_64-unknown-linux-gnu - os: ubuntu-latest - cross: true - - target: aarch64-unknown-linux-musl - os: ubuntu-latest - cross: true - - target: i686-unknown-linux-gnu - os: ubuntu-latest - cross: true - - target: aarch64-unknown-linux-gnu - os: ubuntu-latest - cross: true - - target: arm-unknown-linux-gnueabi - os: ubuntu-latest - cross: true - - target: arm-unknown-linux-gnueabihf - os: ubuntu-latest - cross: true - - target: armv7-unknown-linux-gnueabihf - os: ubuntu-latest - cross: true - - target: riscv64gc-unknown-linux-gnu - os: ubuntu-latest - cross: true - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - cross: true - - - target: x86_64-pc-windows-msvc - os: windows-2022 - cross: false - - target: i686-pc-windows-msvc - os: windows-2022 - cross: false - - target: aarch64-pc-windows-msvc - os: windows-2022 - cross: false - - - target: x86_64-apple-darwin - os: macos-latest - cross: false - - target: aarch64-apple-darwin - os: macos-latest - cross: false - - - target: x86_64-unknown-netbsd - os: ubuntu-latest - cross: true - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - override: true - - uses: Swatinem/rust-cache@v1 - with: - key: ${{ matrix.target }} - cache-on-failure: true - - uses: actions-rs/cargo@v1 - name: Compile - with: - use-cross: ${{ matrix.cross }} - command: build - args: --release --locked --bin cube_shuffle-cli --target ${{ matrix.target }} --target-dir "${{ github.workspace }}/cli_build" - - name: Rename executable - run: > - mv - "${{ github.workspace }}/cli_build/${{ matrix.target }}/release/cube_shuffle-cli${{runner.os == 'Windows' && '.exe' || ''}}" - "cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}" - - uses: actions/upload-artifact@v3 - name: Upload executable - with: - name: CubeShuffle-cli_${{ matrix.target }} - if-no-files-found: error - path: "cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}" + uses: './.github/workflows/cli-builds.yml' cordova-build: - container: - image: cimg/android:2022.09.2-node - options: --user root - runs-on: ubuntu-latest - needs: [ wasm-build ] - steps: - - name: Install cordova - run: npm install -g cordova@11.0.0 - - name: Install Android build tools - run: sdkmanager "build-tools;32.0.0" - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - path: ${{ env.SOURCE_PATH }} - - name: Download compiled WASM - uses: actions/download-artifact@v3 - with: - name: CubeShuffle-wasm - path: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/www" - - name: Build Android - working-directory: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova" - run: | - cordova platform add android --no-telemetry --verbose - cordova build android --device --release --no-telemetry --verbose - - name: Extract build output - run: mv "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/platforms/android/app/build/outputs/bundle/release/app-release.aab" "./CubeShuffle_Android.aab" - - uses: actions/upload-artifact@v3 - with: - name: CubeShuffle-Cordova-Android-Bundle - if-no-files-found: error - path: "./CubeShuffle_Android.aab" - - apk-generate: - container: - image: openjdk:19-jdk-slim-bullseye - runs-on: ubuntu-latest - needs: [ cordova-build ] - steps: - - name: Install dependencies - run: | - apt-get -y update - apt-get -y install wget unzip git - - uses: actions/checkout@v3 - with: - submodules: false - path: ${{ env.SOURCE_PATH }} - - name: Download bundletool - run: wget -O bundletool.jar https://github.com/google/bundletool/releases/download/1.9.0/bundletool-all-1.9.0.jar - - name: Download AAB - uses: actions/download-artifact@v3 - with: - name: CubeShuffle-Cordova-Android-Bundle - - name: Build signed APKS - if: startsWith(github.ref, 'refs/tags/v') - run: > - java -jar "./bundletool.jar" build-apks - --mode="universal" - --ks="${{ env.SOURCE_PATH }}/cubeshuffle.keystore" - --ks-pass="pass:${{ secrets.KEYSTORE_PASSWORD }}" - --ks-key-alias="cush" - --bundle="./CubeShuffle_Android.aab" - --output="./CubeShuffle_Android.apks" - - name: Build unsigned APKS - if: startsWith(github.ref, 'refs/tags/v') != true - run: > - java -jar "./bundletool.jar" build-apks - --mode="universal" - --bundle="./CubeShuffle_Android.aab" - --output="./CubeShuffle_Android.apks" - - name: Extract APK - run: unzip -p "./CubeShuffle_Android.apks" "universal.apk" > "./CubeShuffle_Android.apk" - - uses: actions/upload-artifact@v3 - with: - name: CubeShuffle-Cordova-Android-Universal - if-no-files-found: error - path: | - ./CubeShuffle_Android.apk - - publish: - needs: [ cordova-build, cli-build, tauri-build, wasm-build, apk-generate ] - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - steps: - - uses: actions/download-artifact@v3 - - name: List artifacts - run: ls -R - - name: Install jq - run: | - sudo apt-get -y update - sudo apt-get -y install jq - - name: Make update json - run: | - jq -n \ - --arg version "${GITHUB_REF##*/v}" \ - --arg tag_version "${GITHUB_REF##*/}" \ - --arg now `date --iso-8601=ns` \ - '{ - "name": $version, - "notes": "All releases at https://github.com/philipborg/CubeShuffle/releases", - "pub_date": $now, - "platforms": { - "darwin-aarch64": { - "signature": "", - "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz") - }, - "darwin-x86_64": { - "signature": "", - "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz") - }, - "linux-x86_64": { - "signature": "", - "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.AppImage.tar.gz") - }, - "windows-x86_64": { - "signature": "", - "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.msi.zip") - } - } - }' \ - > "update_info.json" - - name: Release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: true - draft: true - fail_on_unmatched_files: true - prerelease: true - files: | - CubeShuffle-Cordova-Android-Bundle/CubeShuffle_Android.aab - CubeShuffle-Cordova-Android-Universal/CubeShuffle_Android.apk - CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage - CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage.tar.gz - CubeShuffle-Tauri_Linux_X64.deb/CubeShuffle-GUI.deb - CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi - CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi.zip - CubeShuffle-Tauri_macOS_Universal.dmg/CubeShuffle-GUI.dmg - CubeShuffle-Tauri_macOS_Universal.app/CubeShuffle-GUI.app.tar.gz - CubeShuffle-cli_*/* - update_info.json \ No newline at end of file + uses: './.github/workflows/cordova-build.yml' + needs: wasm-build diff --git a/.github/workflows/cli-builds.yml b/.github/workflows/cli-builds.yml new file mode 100644 index 0000000..de9e44d --- /dev/null +++ b/.github/workflows/cli-builds.yml @@ -0,0 +1,114 @@ +name: Build CLI binaries + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + cli-build: + strategy: + fail-fast: false + matrix: + target: [ + x86_64-unknown-linux-gnu, + aarch64-unknown-linux-musl, + i686-unknown-linux-gnu, + aarch64-unknown-linux-gnu, + arm-unknown-linux-gnueabi, + arm-unknown-linux-gnueabihf, + armv7-unknown-linux-gnueabihf, + riscv64gc-unknown-linux-gnu, + x86_64-unknown-linux-musl, + + x86_64-pc-windows-msvc, + i686-pc-windows-msvc, + aarch64-pc-windows-msvc, + + x86_64-apple-darwin, + aarch64-apple-darwin, + + x86_64-unknown-netbsd, + ] + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + cross: true + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + cross: true + - target: i686-unknown-linux-gnu + os: ubuntu-latest + cross: true + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + cross: true + - target: arm-unknown-linux-gnueabi + os: ubuntu-latest + cross: true + - target: arm-unknown-linux-gnueabihf + os: ubuntu-latest + cross: true + - target: armv7-unknown-linux-gnueabihf + os: ubuntu-latest + cross: true + - target: riscv64gc-unknown-linux-gnu + os: ubuntu-latest + cross: true + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + cross: true + + - target: x86_64-pc-windows-msvc + os: windows-2022 + cross: false + - target: i686-pc-windows-msvc + os: windows-2022 + cross: false + - target: aarch64-pc-windows-msvc + os: windows-2022 + cross: false + + - target: x86_64-apple-darwin + os: macos-latest + cross: false + - target: aarch64-apple-darwin + os: macos-latest + cross: false + + - target: x86_64-unknown-netbsd + os: ubuntu-latest + cross: true + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + override: true + - uses: Swatinem/rust-cache@v1 + with: + key: ${{ matrix.target }} + cache-on-failure: true + - uses: actions-rs/cargo@v1 + name: Compile + with: + use-cross: ${{ matrix.cross }} + command: build + args: --release --locked --bin cube_shuffle-cli --target ${{ matrix.target }} --target-dir "${{ github.workspace }}/cli_build" + - name: Rename executable + run: > + mv + "${{ github.workspace }}/cli_build/${{ matrix.target }}/release/cube_shuffle-cli${{runner.os == 'Windows' && '.exe' || ''}}" + "cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}" + - uses: actions/upload-artifact@v3 + name: Upload executable + with: + name: CubeShuffle-cli_${{ matrix.target }} + if-no-files-found: error + path: "cube_shuffle-cli_${{ matrix.target }}${{runner.os == 'Windows' && '.exe' || ''}}" \ No newline at end of file diff --git a/.github/workflows/cordova-build.yml b/.github/workflows/cordova-build.yml new file mode 100644 index 0000000..e230ef3 --- /dev/null +++ b/.github/workflows/cordova-build.yml @@ -0,0 +1,83 @@ +name: Builds the Cordova project from pre-built WASM + +on: + workflow_call: + +jobs: + cordova-build: + container: + image: cimg/android:2022.09.2-node + options: --user root + runs-on: ubuntu-latest + steps: + - name: Install cordova + run: npm install -g cordova@11.0.0 + - name: Install Android build tools + run: sdkmanager "build-tools;32.0.0" + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - name: Download compiled WASM + uses: actions/download-artifact@v3 + with: + name: CubeShuffle-wasm + path: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/www" + - name: Build Android + working-directory: "${{ env.SOURCE_PATH }}/cube_shuffle-cordova" + run: | + cordova platform add android --no-telemetry --verbose + cordova build android --device --release --no-telemetry --verbose + - name: Extract build output + run: mv "${{ env.SOURCE_PATH }}/cube_shuffle-cordova/platforms/android/app/build/outputs/bundle/release/app-release.aab" "./CubeShuffle_Android.aab" + - uses: actions/upload-artifact@v3 + with: + name: CubeShuffle-Cordova-Android-Bundle + if-no-files-found: error + path: "./CubeShuffle_Android.aab" + + apk-generate: + container: + image: openjdk:19-jdk-slim-bullseye + runs-on: ubuntu-latest + needs: [ cordova-build ] + steps: + - name: Install dependencies + run: | + apt-get -y update + apt-get -y install wget unzip git + - uses: actions/checkout@v3 + with: + submodules: false + path: ${{ env.SOURCE_PATH }} + - name: Download bundletool + run: wget -O bundletool.jar https://github.com/google/bundletool/releases/download/1.9.0/bundletool-all-1.9.0.jar + - name: Download AAB + uses: actions/download-artifact@v3 + with: + name: CubeShuffle-Cordova-Android-Bundle + - name: Build signed APKS + if: startsWith(github.ref, 'refs/tags/v') + run: > + java -jar "./bundletool.jar" build-apks + --mode="universal" + --ks="${{ env.SOURCE_PATH }}/cubeshuffle.keystore" + --ks-pass="pass:${{ secrets.KEYSTORE_PASSWORD }}" + --ks-key-alias="cush" + --bundle="./CubeShuffle_Android.aab" + --output="./CubeShuffle_Android.apks" + - name: Build unsigned APKS + if: startsWith(github.ref, 'refs/tags/v') != true + run: > + java -jar "./bundletool.jar" build-apks + --mode="universal" + --bundle="./CubeShuffle_Android.aab" + --output="./CubeShuffle_Android.apks" + - name: Extract APK + run: unzip -p "./CubeShuffle_Android.apks" "universal.apk" > "./CubeShuffle_Android.apk" + - uses: actions/upload-artifact@v3 + with: + name: CubeShuffle-Cordova-Android-Universal + if-no-files-found: error + path: | + ./CubeShuffle_Android.apk \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0fe8bf3 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,70 @@ +name: Publish a new version + +on: + workflow_dispatch: + +jobs: + build: + uses: './.github/workflows/build.yml' + + publish: + needs: [ build ] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v3 + - name: List artifacts + run: ls -R + - name: Install jq + run: | + sudo apt-get -y update + sudo apt-get -y install jq + - name: Make update json + run: | + jq -n \ + --arg version "${GITHUB_REF##*/v}" \ + --arg tag_version "${GITHUB_REF##*/}" \ + --arg now `date --iso-8601=ns` \ + '{ + "name": $version, + "notes": "All releases at https://github.com/philipborg/CubeShuffle/releases", + "pub_date": $now, + "platforms": { + "darwin-aarch64": { + "signature": "", + "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz") + }, + "darwin-x86_64": { + "signature": "", + "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.app.tar.gz") + }, + "linux-x86_64": { + "signature": "", + "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.AppImage.tar.gz") + }, + "windows-x86_64": { + "signature": "", + "url": ("https://github.com/philipborg/CubeShuffle/releases/download/" + $tag_version + "/CubeShuffle-GUI.msi.zip") + } + } + }' \ + > "update_info.json" + - name: Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + draft: true + fail_on_unmatched_files: true + prerelease: true + files: | + CubeShuffle-Cordova-Android-Bundle/CubeShuffle_Android.aab + CubeShuffle-Cordova-Android-Universal/CubeShuffle_Android.apk + CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage + CubeShuffle-Tauri_Linux_X64.AppImage/CubeShuffle-GUI.AppImage.tar.gz + CubeShuffle-Tauri_Linux_X64.deb/CubeShuffle-GUI.deb + CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi + CubeShuffle-Tauri_Windows_X64.msi/CubeShuffle-GUI.msi.zip + CubeShuffle-Tauri_macOS_Universal.dmg/CubeShuffle-GUI.dmg + CubeShuffle-Tauri_macOS_Universal.app/CubeShuffle-GUI.app.tar.gz + CubeShuffle-cli_*/* + update_info.json \ No newline at end of file diff --git a/.github/workflows/tauri-linux-build.yml b/.github/workflows/tauri-linux-build.yml new file mode 100644 index 0000000..c2af099 --- /dev/null +++ b/.github/workflows/tauri-linux-build.yml @@ -0,0 +1,80 @@ +name: Tauri Linux Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_CLI_VERSION: + required: true + type: string + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + build-tauri: + name: Builds Tauri for Linux + runs-on: ubuntu-latest + steps: + - name: Install webkit/GTK dependencies (Linux) + run: | + sudo apt-get -y update + sudo apt-get -y install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + components: rustfmt, clippy + override: true + - uses: Swatinem/rust-cache@v1 + with: + working-directory: ${{ env.SOURCE_PATH }} + cache-on-failure: true + key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }} + - name: Install Trunk + run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }} + - name: Install Tauri + run: cargo install tauri-cli --locked --version ${{ inputs.TAURI_CLI_VERSION }} + + - name: Tauri Build + run: cargo tauri build || true + working-directory: "${{ env.SOURCE_PATH }}/src-tauri" + + - uses: actions/upload-artifact@v3 + name: Tauri Linux executable + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}_EXECUTABLE + path: "${{ env.SOURCE_PATH }}/target/release/cube-shuffle" + - name: Exfiltrate deb + run: mv "${{ env.SOURCE_PATH }}/target/release/bundle/deb/cube-shuffle"*".deb" "CubeShuffle-GUI.deb" + - uses: actions/upload-artifact@v3 + name: Tauri Linux deb + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.deb + path: "CubeShuffle-GUI.deb" + - name: Exfiltrate AppImage + run: | + mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage" "CubeShuffle-GUI.AppImage" + mv "${{ env.SOURCE_PATH }}/target/release/bundle/appimage/cube-shuffle"*".AppImage.tar.gz" "CubeShuffle-GUI.AppImage.tar.gz" + - uses: actions/upload-artifact@v3 + name: Tauri Linux AppImage + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.AppImage + path: "CubeShuffle-GUI.AppImage*" diff --git a/.github/workflows/tauri-macos-build.yml b/.github/workflows/tauri-macos-build.yml new file mode 100644 index 0000000..c837139 --- /dev/null +++ b/.github/workflows/tauri-macos-build.yml @@ -0,0 +1,63 @@ +name: Tauri MacOS Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_CLI_VERSION: + required: true + type: string + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + build-tauri: + name: Builds Tauri for MacOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + components: rustfmt, clippy + override: true + - name: Install aarch64 Darwin + run: rustup target add aarch64-apple-darwin + - uses: Swatinem/rust-cache@v1 + with: + working-directory: ${{ inputs.SOURCE_PATH }} + cache-on-failure: true + key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }} + - name: Install Trunk + run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }} + - name: Install Tauri + run: cargo install tauri-cli --locked --version ${{ inputs.TAURI_CLI_VERSION }} + + - name: Tauri Build + run: cargo tauri build --target universal-apple-darwin || true + working-directory: "${{ env.SOURCE_PATH }}/src-tauri" + + - name: Exfiltrate macOS app + run: mv "${{ env.SOURCE_PATH }}/target/universal-apple-darwin/release/bundle/macos/CubeShuffle.app.tar.gz" "CubeShuffle-GUI.app.tar.gz" + - uses: actions/upload-artifact@v3 + name: Tauri macOS app + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_Universal.app + path: "CubeShuffle-GUI.app.tar.gz" + - name: Exfiltrate macOS dmg + run: mv "${{ env.SOURCE_PATH }}/target/universal-apple-darwin/release/bundle/dmg/CubeShuffle"*".dmg" "./CubeShuffle-GUI.dmg" + - uses: actions/upload-artifact@v3 + name: Tauri macOS dmg + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_Universal.dmg + path: "./CubeShuffle-GUI.dmg" diff --git a/.github/workflows/tauri-windows-build.yml b/.github/workflows/tauri-windows-build.yml new file mode 100644 index 0000000..9eab2dc --- /dev/null +++ b/.github/workflows/tauri-windows-build.yml @@ -0,0 +1,58 @@ +name: Tauri Windows Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_CLI_VERSION: + required: true + type: string + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + build-tauri: + name: Builds Tauri for Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + components: rustfmt, clippy + override: true + - uses: Swatinem/rust-cache@v1 + with: + working-directory: ${{ env.SOURCE_PATH }} + cache-on-failure: true + key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }} + - name: Install Trunk + run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }} + - name: Install Tauri + run: cargo install tauri-cli --locked --version ${{ inputs.TAURI_CLI_VERSION }} + + - name: Windows CMD workaround + run: trunk build --release --dist "./../src-tauri/websrc" + working-directory: "${{ env.SOURCE_PATH }}/cube_shuffle-wasm" + - name: Tauri Build + run: cargo tauri build || true + working-directory: "${{ env.SOURCE_PATH }}/src-tauri" + + - name: Exfiltrate MSI + run: | + mv "${{ env.SOURCE_PATH }}/target/release/bundle/msi/CubeShuffle*.msi" "./CubeShuffle-GUI.msi" + mv "${{ env.SOURCE_PATH }}/target/release/bundle/msi/CubeShuffle*.msi.zip" "./CubeShuffle-GUI.msi.zip" + - uses: actions/upload-artifact@v3 + name: Tauri Windows Installer + with: + if-no-files-found: error + name: CubeShuffle-Tauri_${{ runner.os }}_${{ runner.arch }}.msi + path: "./CubeShuffle-GUI.msi*" diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..e244861 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,60 @@ +name: Validate cargo projects + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + validate: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install webkit/GTK dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get -y update + sudo apt-get -y install libwebkit2gtk-4.0-dev \ + build-essential \ + curl \ + wget \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt, clippy + override: true + - uses: Swatinem/rust-cache@v1 + with: + working-directory: ${{ env.SOURCE_PATH }} + cache-on-failure: true + key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }} + + - name: Fake websrc + shell: pwsh + working-directory: ${{ env.SOURCE_PATH }} + run: New-Item -ItemType "directory" -Path "./src-tauri/websrc" + - name: Cargo build + run: cargo build --verbose --locked --release + working-directory: ${{ env.SOURCE_PATH }} + + - name: Run tests + run: cargo test --verbose --locked --release --no-fail-fast + working-directory: ${{ env.SOURCE_PATH }} + - name: Clippy + run: cargo clippy --all-features --workspace --all-targets -- -D warnings + working-directory: ${{ env.SOURCE_PATH }} + - name: Format check + run: cargo fmt --all --check + working-directory: ${{ env.SOURCE_PATH }} \ No newline at end of file diff --git a/.github/workflows/wasm-build.yml b/.github/workflows/wasm-build.yml new file mode 100644 index 0000000..4e4e41d --- /dev/null +++ b/.github/workflows/wasm-build.yml @@ -0,0 +1,42 @@ +name: Build WebAssembly files + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + +env: + CARGO_TERM_COLOR: always + SOURCE_PATH: "./src" + +jobs: + wasm-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + override: true + - uses: Swatinem/rust-cache@v1 + with: + working-directory: ${{ env.SOURCE_PATH }} + cache-on-failure: true + key: Trunk_${{ inputs.TRUNK_VERSION }} + - name: Install Trunk + run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }} + - name: Build WASM + run: trunk build --release --dist "${{ github.workspace }}/wasm_build" + working-directory: ${{ env.SOURCE_PATH }}/cube_shuffle-wasm + - name: Upload wasm + uses: actions/upload-artifact@v3 + with: + name: CubeShuffle-wasm + if-no-files-found: error + path: "${{ github.workspace }}/wasm_build" \ No newline at end of file