Skip to content

Commit

Permalink
Add GitHub Actions workflow for PR validation with build and test jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Almasi committed Dec 8, 2024
1 parent 929547d commit 5af3be7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 22 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: PR Validation

on:
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build-and-test:
runs-on: ${{ matrix.platform.os }}

strategy:
fail-fast: false

matrix:
platform:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
command: cargo

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
command: cross

- os: windows-latest
target: x86_64-pc-windows-msvc
command: cargo

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Cargo and cross
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ matrix.platform.target }}-cargo

- name: Install cross
if: matrix.platform.command == 'cross'
run: |
if ! command -v cross &>/dev/null; then
cargo install cross
fi
- name: Build
run: ${{ matrix.platform.command }} build --target ${{ matrix.platform.target }}

- name: Test
run: ${{ matrix.platform.command }} test --target ${{ matrix.platform.target }}
22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

0 comments on commit 5af3be7

Please sign in to comment.