From 91853de375137b36a9d8e98b10bfca0a1c850a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 13:03:48 +0200 Subject: [PATCH 01/11] Move all logic of build.yml to called workflows. --- .github/workflows/build.yml | 409 +----------------- .github/workflows/publish.yml | 70 +++ .github/workflows/templates/cli-builds.yml | 114 +++++ .github/workflows/templates/cordova-build.yml | 83 ++++ .../workflows/templates/tauri-linux-build.yml | 80 ++++ .../workflows/templates/tauri-macos-build.yml | 63 +++ .../templates/tauri-windows-build.yml | 58 +++ .github/workflows/templates/validate.yml | 37 ++ .github/workflows/templates/wasm-build.yml | 42 ++ 9 files changed, 564 insertions(+), 392 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/templates/cli-builds.yml create mode 100644 .github/workflows/templates/cordova-build.yml create mode 100644 .github/workflows/templates/tauri-linux-build.yml create mode 100644 .github/workflows/templates/tauri-macos-build.yml create mode 100644 .github/workflows/templates/tauri-windows-build.yml create mode 100644 .github/workflows/templates/validate.yml create mode 100644 .github/workflows/templates/wasm-build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12aca9e..8cd1fa7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,6 @@ on: branches: [ 'master', 'develop' ] pull_request: branches: [ 'master', 'develop' ] - workflow_dispatch: env: CARGO_TERM_COLOR: always @@ -16,402 +15,28 @@ env: 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" + template: [ + 'tauri-linux-build', + 'tauri-macos-build', + 'tauri-windows-build' + ] + uses: './.github/workflows/templates/${{ matrix.template }}.yml' + with: + TRUNK_VERSION: ${{ env.TRUNK_VERSION }} + TAURI_CLI_VERSION: ${{ env.TAURI_CLI_VERSION }} - - 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 }} + validate: + uses: './.github/workflows/templates/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/templates/wasm-build.yml' + with: + TRUNK_VERSION: ${{ env.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/templates/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/templates/cordova-build.yml' + needs: wasm-build 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/templates/cli-builds.yml b/.github/workflows/templates/cli-builds.yml new file mode 100644 index 0000000..de9e44d --- /dev/null +++ b/.github/workflows/templates/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/templates/cordova-build.yml b/.github/workflows/templates/cordova-build.yml new file mode 100644 index 0000000..c9906d9 --- /dev/null +++ b/.github/workflows/templates/cordova-build.yml @@ -0,0 +1,83 @@ +name: Builds the Cordova project from pre-built WASM + +on: + workflow_call: + +job: + 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/templates/tauri-linux-build.yml b/.github/workflows/templates/tauri-linux-build.yml new file mode 100644 index 0000000..b3a4554 --- /dev/null +++ b/.github/workflows/templates/tauri-linux-build.yml @@ -0,0 +1,80 @@ +name: Tauri Linux Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_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_${{ input.TRUNK_VERSION }}-TauriCLI_${{ input.TAURI_CLI_VERSION }} + - name: Install Trunk + run: cargo install --locked trunk --version ${{ input.TRUNK_VERSION }} + - name: Install Tauri + run: cargo install tauri-cli --locked --version ${{ input.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/templates/tauri-macos-build.yml b/.github/workflows/templates/tauri-macos-build.yml new file mode 100644 index 0000000..9057d6b --- /dev/null +++ b/.github/workflows/templates/tauri-macos-build.yml @@ -0,0 +1,63 @@ +name: Tauri MacOS Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_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/templates/tauri-windows-build.yml b/.github/workflows/templates/tauri-windows-build.yml new file mode 100644 index 0000000..afdf855 --- /dev/null +++ b/.github/workflows/templates/tauri-windows-build.yml @@ -0,0 +1,58 @@ +name: Tauri Windows Build + +on: + workflow_call: + inputs: + TRUNK_VERSION: + required: true + type: string + TAURI_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/templates/validate.yml b/.github/workflows/templates/validate.yml new file mode 100644 index 0000000..90e2d81 --- /dev/null +++ b/.github/workflows/templates/validate.yml @@ -0,0 +1,37 @@ +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: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + path: ${{ env.SOURCE_PATH }} + - name: Fake websrc + shell: python + working-directory: ${{ env.SOURCE_PATH }} + run: os.mkdir("./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/templates/wasm-build.yml b/.github/workflows/templates/wasm-build.yml new file mode 100644 index 0000000..4e4e41d --- /dev/null +++ b/.github/workflows/templates/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 From b8241e75b69f888a50c6848daa9e989529321f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 13:05:39 +0200 Subject: [PATCH 02/11] Remove templates directory. --- .github/workflows/build.yml | 10 +++++----- .github/workflows/{templates => }/cli-builds.yml | 0 .github/workflows/{templates => }/cordova-build.yml | 0 .../workflows/{templates => }/tauri-linux-build.yml | 0 .../workflows/{templates => }/tauri-macos-build.yml | 0 .../workflows/{templates => }/tauri-windows-build.yml | 0 .github/workflows/{templates => }/validate.yml | 0 .github/workflows/{templates => }/wasm-build.yml | 0 8 files changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{templates => }/cli-builds.yml (100%) rename .github/workflows/{templates => }/cordova-build.yml (100%) rename .github/workflows/{templates => }/tauri-linux-build.yml (100%) rename .github/workflows/{templates => }/tauri-macos-build.yml (100%) rename .github/workflows/{templates => }/tauri-windows-build.yml (100%) rename .github/workflows/{templates => }/validate.yml (100%) rename .github/workflows/{templates => }/wasm-build.yml (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8cd1fa7..c0eb7b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,22 +21,22 @@ jobs: 'tauri-macos-build', 'tauri-windows-build' ] - uses: './.github/workflows/templates/${{ matrix.template }}.yml' + uses: './.github/workflows/${{ matrix.template }}.yml' with: TRUNK_VERSION: ${{ env.TRUNK_VERSION }} TAURI_CLI_VERSION: ${{ env.TAURI_CLI_VERSION }} validate: - uses: './.github/workflows/templates/validate.yml' + uses: './.github/workflows/validate.yml' wasm-build: - uses: './.github/workflows/templates/wasm-build.yml' + uses: './.github/workflows/wasm-build.yml' with: TRUNK_VERSION: ${{ env.TRUNK_VERSION }} cli-build: - uses: './.github/workflows/templates/cli-builds.yml' + uses: './.github/workflows/cli-builds.yml' cordova-build: - uses: './.github/workflows/templates/cordova-build.yml' + uses: './.github/workflows/cordova-build.yml' needs: wasm-build diff --git a/.github/workflows/templates/cli-builds.yml b/.github/workflows/cli-builds.yml similarity index 100% rename from .github/workflows/templates/cli-builds.yml rename to .github/workflows/cli-builds.yml diff --git a/.github/workflows/templates/cordova-build.yml b/.github/workflows/cordova-build.yml similarity index 100% rename from .github/workflows/templates/cordova-build.yml rename to .github/workflows/cordova-build.yml diff --git a/.github/workflows/templates/tauri-linux-build.yml b/.github/workflows/tauri-linux-build.yml similarity index 100% rename from .github/workflows/templates/tauri-linux-build.yml rename to .github/workflows/tauri-linux-build.yml diff --git a/.github/workflows/templates/tauri-macos-build.yml b/.github/workflows/tauri-macos-build.yml similarity index 100% rename from .github/workflows/templates/tauri-macos-build.yml rename to .github/workflows/tauri-macos-build.yml diff --git a/.github/workflows/templates/tauri-windows-build.yml b/.github/workflows/tauri-windows-build.yml similarity index 100% rename from .github/workflows/templates/tauri-windows-build.yml rename to .github/workflows/tauri-windows-build.yml diff --git a/.github/workflows/templates/validate.yml b/.github/workflows/validate.yml similarity index 100% rename from .github/workflows/templates/validate.yml rename to .github/workflows/validate.yml diff --git a/.github/workflows/templates/wasm-build.yml b/.github/workflows/wasm-build.yml similarity index 100% rename from .github/workflows/templates/wasm-build.yml rename to .github/workflows/wasm-build.yml From 402ddc99b1392a9c9e66a0179283511c0ddcbd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 13:07:07 +0200 Subject: [PATCH 03/11] Fix typo `job` to `jobs`. --- .github/workflows/cordova-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cordova-build.yml b/.github/workflows/cordova-build.yml index c9906d9..e230ef3 100644 --- a/.github/workflows/cordova-build.yml +++ b/.github/workflows/cordova-build.yml @@ -3,7 +3,7 @@ name: Builds the Cordova project from pre-built WASM on: workflow_call: -job: +jobs: cordova-build: container: image: cimg/android:2022.09.2-node From f1e73be28e325b5fd78effc1bcaefc320810e158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 14:59:34 +0200 Subject: [PATCH 04/11] Experimentally disable tauri-build --- .github/workflows/build.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0eb7b8..cd16d5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,7 @@ on: branches: [ 'master', 'develop' ] pull_request: branches: [ 'master', 'develop' ] + workflow_call: env: CARGO_TERM_COLOR: always @@ -13,18 +14,18 @@ env: TAURI_CLI_VERSION: "1.1.1" jobs: - tauri-build: - strategy: - matrix: - template: [ - 'tauri-linux-build', - 'tauri-macos-build', - 'tauri-windows-build' - ] - uses: './.github/workflows/${{ matrix.template }}.yml' - with: - TRUNK_VERSION: ${{ env.TRUNK_VERSION }} - TAURI_CLI_VERSION: ${{ env.TAURI_CLI_VERSION }} +# tauri-build: +# strategy: +# matrix: +# template: [ +# 'tauri-linux-build', +# 'tauri-macos-build', +# 'tauri-windows-build' +# ] +# uses: './.github/workflows/${{ matrix.template }}.yml' +# with: +# TRUNK_VERSION: ${{ env.TRUNK_VERSION }} +# TAURI_CLI_VERSION: ${{ env.TAURI_CLI_VERSION }} validate: uses: './.github/workflows/validate.yml' From 8da6966944816187f6f592665807bd5e25a22e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:01:11 +0200 Subject: [PATCH 05/11] Experimentally disable workflow call --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd16d5a..bfc501d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,6 @@ on: branches: [ 'master', 'develop' ] pull_request: branches: [ 'master', 'develop' ] - workflow_call: env: CARGO_TERM_COLOR: always From dabb7ecec08321f3f0ec3f11061d1c6daf921db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:06:12 +0200 Subject: [PATCH 06/11] Change format of environment variables. --- .github/workflows/build.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfc501d..597184b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,7 @@ on: branches: [ 'master', 'develop' ] pull_request: branches: [ 'master', 'develop' ] + workflow_dispatch: env: CARGO_TERM_COLOR: always @@ -13,18 +14,18 @@ env: TAURI_CLI_VERSION: "1.1.1" jobs: -# tauri-build: -# strategy: -# matrix: -# template: [ -# 'tauri-linux-build', -# 'tauri-macos-build', -# 'tauri-windows-build' -# ] -# uses: './.github/workflows/${{ matrix.template }}.yml' -# with: -# TRUNK_VERSION: ${{ env.TRUNK_VERSION }} -# TAURI_CLI_VERSION: ${{ env.TAURI_CLI_VERSION }} + tauri-build: + strategy: + matrix: + template: [ + 'tauri-linux-build', + 'tauri-macos-build', + 'tauri-windows-build' + ] + uses: './.github/workflows/${{ matrix.template }}.yml' + with: + TRUNK_VERSION: ${ TRUNK_VERSION } + TAURI_CLI_VERSION: ${ TAURI_CLI_VERSION } validate: uses: './.github/workflows/validate.yml' @@ -32,7 +33,7 @@ jobs: wasm-build: uses: './.github/workflows/wasm-build.yml' with: - TRUNK_VERSION: ${{ env.TRUNK_VERSION }} + TRUNK_VERSION: ${ TRUNK_VERSION } cli-build: uses: './.github/workflows/cli-builds.yml' From 49a3ade46856ca7e12fabecc7d96f3c639214734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:12:39 +0200 Subject: [PATCH 07/11] Unfold tauri builds. --- .github/workflows/build.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 597184b..742c2a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,15 +14,20 @@ env: TAURI_CLI_VERSION: "1.1.1" jobs: - tauri-build: - strategy: - matrix: - template: [ - 'tauri-linux-build', - 'tauri-macos-build', - 'tauri-windows-build' - ] - uses: './.github/workflows/${{ matrix.template }}.yml' + 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 } From 492be92e8185c0bc4d2c0280b9c8a6f32f032690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:14:15 +0200 Subject: [PATCH 08/11] Fix typo for input to inputs. --- .github/workflows/tauri-linux-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tauri-linux-build.yml b/.github/workflows/tauri-linux-build.yml index b3a4554..c512545 100644 --- a/.github/workflows/tauri-linux-build.yml +++ b/.github/workflows/tauri-linux-build.yml @@ -44,11 +44,11 @@ jobs: with: working-directory: ${{ env.SOURCE_PATH }} cache-on-failure: true - key: Trunk_${{ input.TRUNK_VERSION }}-TauriCLI_${{ input.TAURI_CLI_VERSION }} + key: Trunk_${{ inputs.TRUNK_VERSION }}-TauriCLI_${{ inputs.TAURI_CLI_VERSION }} - name: Install Trunk - run: cargo install --locked trunk --version ${{ input.TRUNK_VERSION }} + run: cargo install --locked trunk --version ${{ inputs.TRUNK_VERSION }} - name: Install Tauri - run: cargo install tauri-cli --locked --version ${{ input.TAURI_CLI_VERSION }} + run: cargo install tauri-cli --locked --version ${{ inputs.TAURI_CLI_VERSION }} - name: Tauri Build run: cargo tauri build || true From 69ccc60ae9882cdea9990fdb13a022b57f3fadbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:15:34 +0200 Subject: [PATCH 09/11] Fix CLI version input parameter name. --- .github/workflows/tauri-linux-build.yml | 2 +- .github/workflows/tauri-macos-build.yml | 2 +- .github/workflows/tauri-windows-build.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tauri-linux-build.yml b/.github/workflows/tauri-linux-build.yml index c512545..c2af099 100644 --- a/.github/workflows/tauri-linux-build.yml +++ b/.github/workflows/tauri-linux-build.yml @@ -6,7 +6,7 @@ on: TRUNK_VERSION: required: true type: string - TAURI_VERSION: + TAURI_CLI_VERSION: required: true type: string diff --git a/.github/workflows/tauri-macos-build.yml b/.github/workflows/tauri-macos-build.yml index 9057d6b..c837139 100644 --- a/.github/workflows/tauri-macos-build.yml +++ b/.github/workflows/tauri-macos-build.yml @@ -6,7 +6,7 @@ on: TRUNK_VERSION: required: true type: string - TAURI_VERSION: + TAURI_CLI_VERSION: required: true type: string diff --git a/.github/workflows/tauri-windows-build.yml b/.github/workflows/tauri-windows-build.yml index afdf855..9eab2dc 100644 --- a/.github/workflows/tauri-windows-build.yml +++ b/.github/workflows/tauri-windows-build.yml @@ -6,7 +6,7 @@ on: TRUNK_VERSION: required: true type: string - TAURI_VERSION: + TAURI_CLI_VERSION: required: true type: string From 62a80a8d4c1d8c400a6ec977765d055dd738a299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:18:53 +0200 Subject: [PATCH 10/11] Use pwsh instead of Python. --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 90e2d81..ba3dd97 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -19,9 +19,9 @@ jobs: submodules: 'recursive' path: ${{ env.SOURCE_PATH }} - name: Fake websrc - shell: python + shell: pwsh working-directory: ${{ env.SOURCE_PATH }} - run: os.mkdir("./src-tauri/websrc") + run: New-Item -ItemType "directory" -Path "./src-tauri/websrc" - name: Cargo build run: cargo build --verbose --locked --release From 4bd4c94a8f3dfbf5a5734768a8c8dcb31b90f9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Borgstr=C3=B6m?= <1827607+philipborg@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:26:03 +0200 Subject: [PATCH 11/11] Add Linux dependencies for validate.yml Add rust-cache to validate.yml --- .github/workflows/validate.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ba3dd97..e244861 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -14,18 +14,41 @@ jobs: 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 }}