Skip to content

Commit 4cc04ca

Browse files
feat: add rust_enable install scripts (#211)
* feat: add rust_enable install scripts * Fix WORKFLOW_BRANCH * Check versions * Fix env * Disable rust for node builds * revert WORKFLOW_BRANCH to main * default enable_rust to false Co-authored-by: Michael Pühringer <[email protected]> * add comments to rust install * default enable_rust to false (again) --------- Co-authored-by: dv-matthew-crown <[email protected]>
1 parent dcaa0c8 commit 4cc04ca

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/actions/build-node-python/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ inputs:
8585
run_python_build:
8686
default: true
8787
required: false
88+
# Rust
89+
enable_rust:
90+
description: "enables the rust part of the action"
91+
default: false
92+
required: true
8893

8994
runs:
9095
using: "composite"
@@ -125,6 +130,29 @@ runs:
125130
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
126131
sudo apt-get install postgresql-16-pgvector -y
127132
shell: bash
133+
# Rust
134+
- name: Install Rust
135+
if: inputs.enable_rust == 'true'
136+
run: |
137+
if ! command -v rustup &> /dev/null ; then
138+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain stable -y
139+
140+
# Resolve the correct CARGO_HOME path depending on OS
141+
if [[ "$RUNNER_OS" == "Windows" ]]; then
142+
echo "${CARGO_HOME:-$USERPROFILE/.cargo}/bin" | sed 's|/|\\|g' >> $GITHUB_PATH
143+
else
144+
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
145+
fi
146+
# Load cargo environment so cargo and rustc are available in this shell
147+
. "$HOME/.cargo/env"
148+
fi
149+
150+
# Ensure stable rust toolchain is installed
151+
rustup install stable
152+
153+
rustc --version
154+
cargo --version
155+
shell: bash
128156
# General
129157
- name: Git config
130158
if: inputs.github_ro_token != ''

.github/workflows/build-node-python.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ on:
7979
required: false
8080
type: boolean
8181
default: false
82+
rust_enable:
83+
description: 'Enable Rust install'
84+
required: false
85+
type: boolean
86+
default: false
8287
timeout:
8388
description: "Timeout for each job in minutes."
8489
type: number
@@ -144,6 +149,8 @@ jobs:
144149
with:
145150
enable_node: true
146151
enable_python: false
152+
# We probably won't need Rust on Node builds...
153+
# enable_rust: ${{ inputs.rust_enable }}
147154
run_parallel: ${{ inputs.run_parallel }}
148155
node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }}
149156
npm_registry: ${{ env.NPM_REGISTRY }}
@@ -183,6 +190,7 @@ jobs:
183190
with:
184191
enable_node: false
185192
enable_python: true
193+
enable_rust: ${{ inputs.rust_enable }}
186194
run_parallel: ${{ inputs.run_parallel }}
187195
node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }}
188196
npm_registry: ${{ env.NPM_REGISTRY }}
@@ -273,6 +281,7 @@ jobs:
273281
- name: Build node and python
274282
uses: ./tmp/github-workflows/.github/actions/build-node-python
275283
with:
284+
enable_rust: ${{ inputs.rust_enable }}
276285
run_parallel: ${{ inputs.run_parallel }}
277286
node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }}
278287
npm_registry: ${{ env.NPM_REGISTRY }}
@@ -415,6 +424,7 @@ jobs:
415424
- name: Build node and python
416425
uses: ./tmp/github-workflows/.github/actions/build-node-python
417426
with:
427+
enable_rust: ${{ inputs.rust_enable }}
418428
run_parallel: ${{ inputs.run_parallel }}
419429
node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }}
420430
npm_registry: ${{ env.NPM_REGISTRY }}

0 commit comments

Comments
 (0)