-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minimal shared rust/python/flatc actions we can reuse in other places (…
…#1) Co-authored-by: Robert Kruszewski <github@robertk.io>
- Loading branch information
1 parent
b35d21e
commit 46996d4
Showing
5 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Setup Flatc | ||
description: Install the flatbuffers compiler | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download flatc | ||
shell: bash | ||
run: | | ||
curl -sL https://github.com/google/flatbuffers/releases/download/v24.3.25/Linux.flatc.binary.clang++-15.zip > ${{ runner.temp }}/flatc.zip | ||
unzip ${{ runner.temp }}/flatc.zip -d ${{ runner.temp }}/flatc | ||
echo "PATH=${{ runner.temp }}/flatc:$PATH" >> $GITHUB_ENV | ||
- name: Export Path | ||
shell: bash | ||
run: echo "PATH=$PATH" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "Setup Rust" | ||
description: "Toolchain setup and Initial compilation" | ||
inputs: | ||
rye-version: | ||
description: "Rye version to use" | ||
required: true | ||
default: "0.41.0" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Rye Cache | ||
id: rye-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.rye | ||
key: "rye-${{ runner.os }}-${{ inputs.rye-version }}" | ||
|
||
- name: Rye Install | ||
shell: bash | ||
run: curl -sSf https://rye.astral.sh/get | bash | ||
if: steps.rye-cache.outputs.cache-hit != 'true' | ||
env: | ||
RYE_VERSION: "${{ inputs.rye-version }}" | ||
RYE_INSTALL_OPTION: "--yes" | ||
|
||
- name: Rye Shims | ||
shell: bash | ||
run: echo "~/.rye/shims" >> $GITHUB_PATH | ||
|
||
- name: Venv Cache | ||
id: venv-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: "venv-${{ runner.os }}-${{ hashFiles('requirements**.lock') }}" | ||
|
||
- name: Rye Sync | ||
shell: bash | ||
# --no-lock prevents resolution of the lock file. The locks are still respected. | ||
# We always run `rye sync` even if the cache fetch was successful since it builds our Rust extensions for us. | ||
run: rye sync --no-lock | ||
|
||
- name: Export Path | ||
shell: bash | ||
run: echo "PATH=$PATH" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Setup Rust | ||
description: Sets up Rust and relevant toolchain components | ||
|
||
inputs: | ||
components: | ||
description: Comma-separated list of components to be additionally installed for a new toolchain | ||
required: false | ||
default: clippy, rustfmt | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Rust Version | ||
id: rust-version | ||
shell: bash | ||
run: echo "version=$(cat rust-toolchain.toml | grep channel | awk -F'\"' '{print $2}')" >> $GITHUB_OUTPUT | ||
|
||
- name: Rust Toolchain | ||
id: rust-toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
if: steps.rustup-cache.outputs.cache-hit != 'true' | ||
with: | ||
toolchain: "${{ steps.rust-version.outputs.version }}" | ||
components: ${{ inputs.components }} | ||
|
||
- name: Rust Dependency Cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
save-if: ${{ github.ref_name == 'develop' }} | ||
shared-key: "shared" # To allow reuse across jobs | ||
|
||
- name: Rust Compile Cache | ||
uses: mozilla-actions/sccache-action@v0.0.6 | ||
|
||
- name: Rust Compile Cache Config | ||
shell: bash | ||
run: | | ||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
.idea | ||
.vscode/ |