Add repeat and shuffle mode #87
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: Rust build | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BINARY_NAME: sonicrust | |
| jobs: | |
| # Build and test job (runs on all pushes and PRs) | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Add Dependency | |
| run: | | |
| sudo apt-get update | |
| sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
| build-essential \ | |
| libchafa-dev \ | |
| g++ \ | |
| pkg-config \ | |
| libx11-dev \ | |
| libasound2-dev \ | |
| libudev-dev \ | |
| libglib2.0-dev | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Run clippy | |
| run: cargo clippy -- -D warnings | |
| # Release job (only runs on version tags) | |
| release: | |
| needs: build-and-test | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| asset_suffix: linux_x86_64 | |
| - os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| asset_suffix: linux_aarch64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}cargo-release-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}cargo-release- | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Add Dependency | |
| run: | | |
| sudo apt-get update | |
| sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
| build-essential \ | |
| libchafa-dev \ | |
| g++ \ | |
| pkg-config \ | |
| libx11-dev \ | |
| libasound2-dev \ | |
| libudev-dev \ | |
| libglib2.0-dev | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Get version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Prepare binary | |
| run: | | |
| mkdir -p sonicrust | |
| cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} sonicrust/${{ env.BINARY_NAME }} | |
| chmod +x sonicrust/${{ env.BINARY_NAME }} | |
| TARBALL_NAME="${{ env.BINARY_NAME }}_${{ steps.version.outputs.VERSION }}_${{ matrix.asset_suffix }}.tar.gz" | |
| tar -czvf "${TARBALL_NAME}" -C sonicrust . | |
| echo "TARBALL_NAME=${TARBALL_NAME}" >> $GITHUB_ENV | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.TARBALL_NAME }} | |
| # generate_release_notes: true | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |