name: Build on: push: branches: [ master, main ] pull_request: branches: [ master, main ] release: types: [ created ] env: CARGO_TERM_COLOR: always jobs: build: name: Build - ${{ matrix.platform.name }} runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false matrix: platform: - name: Linux-x86_64 os: ubuntu-latest target: x86_64-unknown-linux-gnu bin: rlogg command: build - name: Windows-x86_64 os: windows-latest target: x86_64-pc-windows-msvc bin: rlogg.exe command: build - name: macOS-x86_64 os: macos-latest target: x86_64-apple-darwin bin: rlogg command: build - name: macOS-aarch64 os: macos-latest target: aarch64-apple-darwin bin: rlogg command: build steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.platform.target }} - name: Cache cargo registry uses: actions/cache@v4 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v4 with: path: ~/.cargo/git key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo build uses: actions/cache@v4 with: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Install Linux dependencies if: matrix.platform.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev - name: Build run: cargo ${{ matrix.platform.command }} --release --target ${{ matrix.platform.target }} - name: Strip binary (Linux and macOS) if: matrix.platform.os != 'windows-latest' run: strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} - name: Create artifact directory run: mkdir -p artifacts - name: Copy binary to artifacts shell: bash run: | cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} artifacts/ - name: Upload artifact uses: actions/upload-artifact@v4 with: name: rlogg-${{ matrix.platform.name }} path: artifacts/${{ matrix.platform.bin }} retention-days: 30 - name: Upload to release if: github.event_name == 'release' uses: softprops/action-gh-release@v1 with: files: artifacts/${{ matrix.platform.bin }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}