From 3612829e8dc758ca8e311199dfa3987ad0465283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeromos=20Kov=C3=A1cs?= Date: Tue, 22 Oct 2024 09:08:18 +0200 Subject: [PATCH] misc(ci): update checkout action, add windows, macos, use cache, use artifacts --- .github/workflows/rust.yml | 44 ++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 31000a2..f902fbd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,21 +2,47 @@ name: Rust on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always jobs: build: - - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-14 + target: aarch64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: windows-latest + target: x86_64-pc-windows-msvc steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache dependencies + uses: swatinem/rust-cache@v2 + + - name: Build + uses: ClementTsang/cargo-action@v0.0.6 + with: + args: --release --target ${{ matrix.target }} --verbose + command: build + + - name: Run tests + uses: ClementTsang/cargo-action@v0.0.6 + with: + args: --target ${{ matrix.target }} --verbose + command: test + + - name: Upload executable + uses: actions/upload-artifact@v4 + with: + name: cgol-tui-${{ matrix.os }} + path: target/${{ matrix.target }}/release/cgol-tui*