name: Build and Test on: push: branches: [ "main", "master" ] pull_request: branches: [ "main", "master" ] env: CARGO_TERM_COLOR: always jobs: check-and-test: name: Test & Build (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: windows-latest artifact_name: HermesPair-windows-x64.exe binary_path: target/release/hermes-pair.exe upload_name: HermesPair-windows-x64 - os: ubuntu-latest artifact_name: hermes-pair-linux-x64 binary_path: target/release/hermes-pair upload_name: hermes-pair-linux-x64 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Rust toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy, rustfmt - name: Install Linux GUI Dependencies if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libgtk-3-dev - name: Rust Cache uses: Swatinem/rust-cache@v2 - name: Check code formatting run: cargo fmt --check - name: Clippy lints run: cargo clippy --all-targets -- -D warnings - name: Run unit & contract tests run: cargo test --verbose - name: Build release binary run: cargo build --release - name: Prepare Windows artifact if: matrix.os == 'windows-latest' run: | mkdir dist cp target/release/hermes-pair.exe dist/HermesPair-windows-x64.exe - name: Prepare Linux artifact if: matrix.os == 'ubuntu-latest' run: | mkdir dist cp target/release/hermes-pair dist/hermes-pair-linux-x64 chmod +x dist/hermes-pair-linux-x64 - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.upload_name }} path: dist/*