diff --git a/.github/workflows/run-rust-tests.yaml b/.github/workflows/run-rust-tests.yaml new file mode 100644 index 0000000..7ef5277 --- /dev/null +++ b/.github/workflows/run-rust-tests.yaml @@ -0,0 +1,49 @@ +name: run-rust-tests + +on: + pull_request: + +jobs: + run-rust-tests: + runs-on: ubuntu-latest + steps: + - name: Log workflow inputs + run: echo "${{ toJson(github.event.inputs) }}" + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Install rust + shell: bash + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + CARGO_BIN="$HOME/.cargo/bin" + echo 'export PATH="$CARGO_BIN:$PATH"' >> $HOME/.bashrc + echo "$CARGO_BIN" >> $GITHUB_PATH + - name: Install uv + shell: bash + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + UV_BIN="$HOME/.local/bin" + echo 'export PATH="$UV_BIN:$PATH"' >> $HOME/.bashrc + echo "$UV_BIN" >> $GITHUB_PATH + - name: Install (and pin) python version + shell: bash + run: | + uv python install 3.12 + uv python pin 3.12 + - name: Setup uv environment + run: | + uv v + source .venv/bin/activate + uv pip install ray[default] maturin + - name: Restore cache + uses: actions/cache@v4 + with: + path: target/release + key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-deps- + - name: Run tests + run: | + source .venv/bin/activate + cargo test --release