diff --git a/.github/workflows/buildreflect.yml b/.github/workflows/buildreflect.yml new file mode 100644 index 0000000..f3059ba --- /dev/null +++ b/.github/workflows/buildreflect.yml @@ -0,0 +1,240 @@ +name: Reflect + +on: + push: + branches: ["main"] + tags: + - '*' + pull_request: + branches: + - '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + build: + env: + MACOSX_DEPLOYMENT_TARGET: 14.5 + strategy: + fail-fast: false + matrix: + include: + - artifact-name: Windows-x86_64 + os: windows-2025 + tauri-build-flags: --target x86_64-pc-windows-msvc -v -- --workspace --timings + + - artifact-name: Windows-aarch64 + os: windows-2025 + tauri-build-flags: --target aarch64-pc-windows-msvc -v -- --workspace --timings + + - artifact-name: macOS-x86_64 + os: macos-15 + tauri-build-flags: --target x86_64-apple-darwin -v -- --workspace --timings + + - artifact-name: macOS-aarch64 + os: macos-15 + tauri-build-flags: --target aarch64-apple-darwin -v -- --workspace --timings + + - artifact-name: Linux-x86_64 + os: ubuntu-24.04 + tauri-build-flags: --target x86_64-unknown-linux-gnu -v -- --workspace --timings + + # ubuntu-22.04-arm, ubuntu-24.04-arm and windows-11-arm are not supported yet for private repositories (as of Nov 15 2025) + # - artifact-name: Linux-aarch64 + # os: ubuntu-24.04-arm + # tauri-build-flags: --target aarch64-unknown-linux-gnu -v -- --workspace --timings + + name: ${{ matrix.artifact-name }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 + with: + persist-credentials: false + token: ${{secrets.GITHUB_TOKEN}} + + - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 + with: + version: 10.15.0 + + - name: Make GCC 14 the default toolchain (Linux) + if: runner.os == 'Linux' + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 200 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 200 + + - name: Install Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update -q + sudo apt-get install -y \ + build-essential \ + curl \ + file \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + libssl-dev \ + libwebkit2gtk-4.1-dev \ + libxdo-dev \ + wget + + - name: Install Node.js dependencies + run: pnpm install + working-directory: ./apps/reflect + continue-on-error: true + + - name: Set up Windows aarch64 Rust compiler + if: matrix.artifact-name == 'Windows-aarch64' + run: rustup target install aarch64-pc-windows-msvc + + - name: Set up macOS x86_64 Rust compiler + if: matrix.artifact-name == 'macOS-x86_64' + run: rustup target add x86_64-apple-darwin + + - name: Set up sccache + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad + + - name: Build package + run: pnpm run tauri build ${{ matrix.tauri-build-flags }} + working-directory: ./apps/reflect/src-tauri + env: + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: true + + - name: Package artifacts (Windows x86_64) + if: matrix.artifact-name == 'Windows-x86_64' + working-directory: ./apps/reflect/src-tauri + run: | + Compress-Archive -DestinationPath ${{ matrix.artifact-name }}-standalone.zip -Path target/x86_64-pc-windows-msvc/release/* + Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path ${{ matrix.artifact-name }}-standalone.zip,target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe + + - name: Package artifacts (Windows aarch64) + if: matrix.artifact-name == 'Windows-aarch64' + working-directory: ./apps/reflect/src-tauri + run: | + Compress-Archive -DestinationPath ${{ matrix.artifact-name }}-standalone.zip -Path target/aarch64-pc-windows-msvc/release/* + Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path ${{ matrix.artifact-name }}-standalone.zip,target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe + + - name: Package artifacts (macOS x86_64) + if: matrix.artifact-name == 'macOS-x86_64' + working-directory: ./apps/reflect/src-tauri + run: | + zip -j ${{ matrix.artifact-name }}-standalone.zip target/x86_64-apple-darwin/release/* + zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/x86_64-apple-darwin/release/bundle/dmg/*.dmg + + - name: Package artifacts (macOS aarch64) + if: matrix.artifact-name == 'macOS-aarch64' + working-directory: ./apps/reflect/src-tauri + run: | + zip -j ${{ matrix.artifact-name }}-standalone.zip target/aarch64-apple-darwin/release/* + zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/aarch64-apple-darwin/release/bundle/dmg/*.dmg + + - name: Package artifacts (Linux x86_64) + if: matrix.artifact-name == 'Linux-x86_64' + working-directory: ./apps/reflect/src-tauri + run: | + zip -j ${{ matrix.artifact-name }}-standalone.zip target/x86_64-unknown-linux-gnu/release/* + zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm + + - name: Package artifacts (Linux aarch64) + if: matrix.artifact-name == 'Linux-aarch64' + working-directory: ./apps/reflect/src-tauri + run: | + zip -j ${{ matrix.artifact-name }}-standalone.zip target/aarch64-unknown-linux-gnu/release/* + zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/aarch64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/aarch64-unknown-linux-gnu/release/bundle/deb/*.deb target/aarch64-unknown-linux-gnu/release/bundle/rpm/*.rpm + + # our build process doesn't seem to generate a cargo-timing.html file, seems like it's just a package manager log file, just going to ignore it. + #- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + # with: + # name: ${{ matrix.artifact-name }}-cargo-timing.html + # path: apps/reflect/src-tauri/target/cargo-timings/cargo-timing.html + + # Zipping manually works around upload-artifact stripping execute + # permissions from files + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: ${{ matrix.artifact-name }} + path: apps/reflect/src-tauri/${{ matrix.artifact-name }}.zip + + release: + name: Create draft release + needs: [build] + runs-on: ubuntu-24.04 + if: | + github.repository_owner == '2702rebels' && + startsWith(github.ref, 'refs/tags/v') + steps: + - name: Download prebuilt binaries + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 + with: + path: pkg + pattern: "!*-cargo-timing.html" + + - name: Display structure of downloaded files + run: ls -R + + - name: Rename Windows x86_64 artifacts + working-directory: pkg/Windows-x86_64 + run: | + unzip -o Windows-x86_64.zip + rm Windows-x86_64.zip + mv Windows-x86_64-standalone.zip Reflect-${{ github.ref_name }}-Windows-x86_64-standalone.zip + mv Reflect_*_x64-setup.exe Reflect-${{ github.ref_name }}-Windows-x86_64-setup.exe + + - name: Rename Windows aarch64 artifacts + working-directory: pkg/Windows-aarch64 + run: | + unzip -o Windows-aarch64.zip + rm Windows-aarch64.zip + mv Windows-aarch64-standalone.zip Reflect-${{ github.ref_name }}-Windows-aarch64-standalone.zip + mv Reflect_*_arm64-setup.exe Reflect-${{ github.ref_name }}-Windows-aarch64-setup.exe + + - name: Rename macOS x86_64 artifacts + working-directory: pkg/macOS-x86_64 + run: | + unzip -o macOS-x86_64.zip + rm macOS-x86_64.zip + mv macOS-x86_64-standalone.zip Reflect-${{ github.ref_name }}-macOS-x86_64-standalone.zip + mv Reflect_*_x64.dmg Reflect-${{ github.ref_name }}-macOS-x86_64.dmg + + - name: Rename macOS aarch64 artifacts + working-directory: pkg/macOS-aarch64 + run: | + unzip -o macOS-aarch64.zip + rm macOS-aarch64.zip + mv macOS-aarch64-standalone.zip Reflect-${{ github.ref_name }}-macOS-aarch64-standalone.zip + mv Reflect_*_aarch64.dmg Reflect-${{ github.ref_name }}-macOS-aarch64.dmg + + - name: Rename Linux x86_64 artifacts + working-directory: pkg/Linux-x86_64 + run: | + unzip -o Linux-x86_64.zip + rm Linux-x86_64.zip + mv Linux-x86_64-standalone.zip Reflect-${{ github.ref_name }}-Linux-x86_64-standalone.zip + mv Reflect_*_amd64.AppImage Reflect-${{ github.ref_name }}-Linux-x86_64.AppImage + mv Reflect_*_amd64.deb Reflect-${{ github.ref_name }}-Linux-x86_64.deb + mv Reflect-*.x86_64.rpm Reflect-${{ github.ref_name }}-Linux-x86_64.rpm + + # commented due to aforementioned arm64 linux not being supported for private repos on gh yet + # - name: Rename Linux aarch64 artifacts + # working-directory: pkg/Linux-aarch64 + # run: | + # unzip -o Linux-aarch64.zip + # rm Linux-aarch64.zip + # mv Linux-aarch64-standalone.zip Reflect-${{ github.ref_name }}-Linux-aarch64-standalone.zip + # mv Reflect_*_aarch64.AppImage Reflect-${{ github.ref_name }}-Linux-aarch64.AppImage + # mv Reflect_*_arm64.deb Reflect-${{ github.ref_name }}-Linux-aarch64.deb + # mv Reflect-*.aarch64.rpm Reflect-${{ github.ref_name }}-Linux-aarch64.rpm + + - name: Display structure of renamed files + run: ls -R + + - uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b #v1.20.0 + with: + name: Reflect ${{ github.ref_name }} + tag: ${{ github.ref_name }} + artifacts: "pkg/**/*" + draft: true + prerelease: true \ No newline at end of file