Test release ci #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-linux: | |
| name: Build Linux Binaries | |
| strategy: | |
| matrix: | |
| include: | |
| # x86_64 builds | |
| - target: x86_64-unknown-linux-gnu | |
| features: "" | |
| suffix: cpu | |
| runner: ubuntu-latest | |
| - target: x86_64-unknown-linux-gnu | |
| features: "cuda" | |
| suffix: cuda | |
| runner: ubuntu-latest | |
| - target: x86_64-unknown-linux-gnu | |
| features: "cuda,cudnn" | |
| suffix: cuda-cudnn | |
| runner: ubuntu-latest | |
| # aarch64 builds | |
| - target: aarch64-unknown-linux-gnu | |
| features: "" | |
| suffix: cpu | |
| runner: ubuntu-latest | |
| use_cross: true | |
| - target: aarch64-unknown-linux-gnu | |
| features: "cuda" | |
| suffix: cuda | |
| runner: ubuntu-latest | |
| use_cross: true | |
| - target: aarch64-unknown-linux-gnu | |
| features: "cuda,cudnn" | |
| suffix: cuda-cudnn | |
| runner: ubuntu-latest | |
| use_cross: true | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libxkbcommon-dev \ | |
| libwayland-dev \ | |
| libxkbcommon-x11-dev \ | |
| libegl1-mesa-dev \ | |
| libfontconfig1-dev \ | |
| libfreetype6-dev \ | |
| libglib2.0-dev \ | |
| libgtk-4-dev \ | |
| libspeechd-dev \ | |
| libxrandr-dev \ | |
| libxinerama-dev \ | |
| libxcursor-dev \ | |
| libxi-dev \ | |
| libxss-dev \ | |
| libasound2-dev \ | |
| pkg-config | |
| - name: Install cross-compilation tools | |
| if: matrix.use_cross == true | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install CUDA (if needed) | |
| if: contains(matrix.features, 'cuda') | |
| uses: Jimver/cuda-toolkit@7263c89f6aa4f1c5247a0947b8e9f8eedfce66a5 | |
| with: | |
| cuda: "12.4.0" | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build daemon binary | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| # Use cross for cross-compilation builds | |
| if [ -z "${{ matrix.features }}" ]; then | |
| cross build --release --target ${{ matrix.target }} --bin super-stt | |
| else | |
| cross build --release --target ${{ matrix.target }} --bin super-stt --features "${{ matrix.features }}" | |
| fi | |
| else | |
| # Use regular cargo for native builds | |
| if [ -z "${{ matrix.features }}" ]; then | |
| cargo build --release --target ${{ matrix.target }} --bin super-stt | |
| else | |
| cargo build --release --target ${{ matrix.target }} --bin super-stt --features "${{ matrix.features }}" | |
| fi | |
| fi | |
| - name: Build app binary | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} --bin super-stt-app | |
| else | |
| cargo build --release --target ${{ matrix.target }} --bin super-stt-app | |
| fi | |
| - name: Build applet binary | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} --bin super-stt-cosmic-applet | |
| else | |
| cargo build --release --target ${{ matrix.target }} --bin super-stt-cosmic-applet | |
| fi | |
| - name: Create tarball | |
| run: | | |
| mkdir -p dist | |
| # Always include all binaries for native builds | |
| cp target/${{ matrix.target }}/release/super-stt dist/ | |
| cp target/${{ matrix.target }}/release/super-stt-app dist/ | |
| cp target/${{ matrix.target }}/release/super-stt-cosmic-applet dist/ | |
| # Include systemd service files | |
| mkdir -p dist/systemd | |
| if [ -f super-stt/systemd/super-stt.service ]; then | |
| cp super-stt/systemd/super-stt.service dist/systemd/ | |
| fi | |
| # Create tarball with architecture and feature suffix | |
| tar -czf super-stt-${{ matrix.target }}-${{ matrix.suffix }}.tar.gz -C dist . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: super-stt-${{ matrix.target }}-${{ matrix.suffix }} | |
| path: super-stt-${{ matrix.target }}-${{ matrix.suffix }}.tar.gz | |
| create-release: | |
| name: Create Release | |
| needs: build-linux | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 | |
| with: | |
| files: artifacts/**/*.tar.gz | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |