Skip to content

Commit

Permalink
Speed up CI (#20)
Browse files Browse the repository at this point in the history
CI was indeed sped up
  • Loading branch information
ivanleomk authored Jul 8, 2024
1 parent 12e14f1 commit f74eed6
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project - latest
build:
name: Build Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
# - beta
# - nightly
crate:
# - instruct-macros
- instructor
steps:
- uses: actions/checkout@v4
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: ${{ matrix.crate }}
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cd ${{ matrix.crate }} && cargo build --verbose

test:
name: Test Rust project - latest
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
toolchain:
# - stable
# - beta
- nightly
crate:
- instruct-macros
# - instruct-macros
- instructor
steps:
- uses: actions/checkout@v4
- name: Cache cargo-nextest
id: cargo-nextest-cache
uses: actions/cache@v3
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
path: ~/.cargo/bin/cargo-nextest
key: ${{ runner.os }}-cargo-nextest-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-nextest-${{ matrix.toolchain }}-
${{ runner.os }}-cargo-nextest-
path: ${{ matrix.crate }}
- name: Install cargo-nextest
if: steps.cargo-nextest-cache.outputs.cache-hit != 'true'
run: cargo install cargo-nextest --locked
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cd ${{ matrix.crate }} && cargo build --verbose
- run: cd ${{ matrix.crate }} && cargo nextest run --verbose --retries 3
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

0 comments on commit f74eed6

Please sign in to comment.