From e5379d9169cd54f781ca707542490b570c712879 Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Tue, 21 Jan 2025 17:04:52 -0800 Subject: [PATCH 1/4] Add build-and-test workflow --- .github/workflows/build-and-test.yaml | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build-and-test.yaml diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 0000000..35ea1bb --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,47 @@ +name: build-and-test + +on: + pull_request: + +jobs: + run-command: + runs-on: buildjet-8vcpu-ubuntu-2004 + 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: Build project + run: | + source .venv/bin/activate + maturin develop --uv + - name: Run tests + run: | + source .venv/bin/activate + cargo test From 56ade8de29cf54e2e44dae60ae2c675b034e9dfd Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Tue, 21 Jan 2025 17:11:58 -0800 Subject: [PATCH 2/4] Change `runs-on` machine --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 35ea1bb..f53e457 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -5,7 +5,7 @@ on: jobs: run-command: - runs-on: buildjet-8vcpu-ubuntu-2004 + runs-on: ubuntu steps: - name: Log workflow inputs run: echo "${{ toJson(github.event.inputs) }}" From 70f60f47b543e2467e1f12e8b9788bc93d67989c Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Tue, 21 Jan 2025 17:13:50 -0800 Subject: [PATCH 3/4] Update run-on value again --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index f53e457..084c450 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -5,7 +5,7 @@ on: jobs: run-command: - runs-on: ubuntu + runs-on: ubuntu-latest steps: - name: Log workflow inputs run: echo "${{ toJson(github.event.inputs) }}" From b2ba4271bf960a3d31cb18706e48338c355d9557 Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Tue, 21 Jan 2025 17:19:55 -0800 Subject: [PATCH 4/4] Remove maturin build (since it's not needed) --- .../{build-and-test.yaml => run-rust-tests.yaml} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename .github/workflows/{build-and-test.yaml => run-rust-tests.yaml} (79%) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/run-rust-tests.yaml similarity index 79% rename from .github/workflows/build-and-test.yaml rename to .github/workflows/run-rust-tests.yaml index 084c450..7ef5277 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/run-rust-tests.yaml @@ -1,10 +1,10 @@ -name: build-and-test +name: run-rust-tests on: pull_request: jobs: - run-command: + run-rust-tests: runs-on: ubuntu-latest steps: - name: Log workflow inputs @@ -37,11 +37,13 @@ jobs: uv v source .venv/bin/activate uv pip install ray[default] maturin - - name: Build project - run: | - source .venv/bin/activate - maturin develop --uv + - 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 + cargo test --release