diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..113c3e05 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,67 @@ +name: Rust + +on: + push: + branches: + - main + pull_request: + paths: + - rust/** + - .github/workflows/rust.yml + +env: + # This env var is used by Swatinem/rust-cache@v2 for the cache + # key, so we set it to make sure it is always consistent. + CARGO_TERM_COLOR: always + # Disable full debug symbol generation to speed up CI build and keep memory down + # "1" means line tables only, which is useful for panic tracebacks. + RUSTFLAGS: "-C debuginfo=1" + RUST_BACKTRACE: "1" + +jobs: + linux: + timeout-minutes: 30 + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash + working-directory: rust + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - uses: Swatinem/rust-cache@v2 + with: + workspaces: rust + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y protobuf-compiler libssl-dev + - name: Build + run: cargo build --all-features + - name: Run tests + run: cargo test --all-features + macos: + runs-on: macos-12 + timeout-minutes: 30 + defaults: + run: + shell: bash + working-directory: rust + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - name: CPU features + run: sysctl -a | grep cpu + - uses: Swatinem/rust-cache@v2 + with: + workspaces: rust + - name: Install dependencies + run: brew install protobuf + - name: Build + run: cargo build --all-features + - name: Run tests + run: cargo test --all-features