-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom
cargo
command on workflow_dispatch
- Loading branch information
1 parent
1f7f544
commit ee13e1d
Showing
1 changed file
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Commit a temporary `cargo-command.env` on the desired local branch before running workflow | ||
name: Run custom `cargo` command | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
command: | ||
description: 'Cargo command to run' | ||
required: true | ||
type: string | ||
runner: | ||
description: 'GitHub Actions runner' | ||
required: true | ||
default: 'ubuntu-latest' | ||
type: choice | ||
options: | ||
- ubuntu-latest | ||
- buildjet-32vcpu-ubuntu-2204 | ||
- gpu-bench | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
gpu-script: | ||
name: Run custom `ci-script.sh` on GPU | ||
if: github.event.inputs.runner == 'gpu-bench' | ||
runs-on: [self-hosted, "${{ github.event.inputs.runner }}", "NVIDIA L4"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Install dependencies | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Set up GPU if applicable | ||
run: | | ||
nvidia-smi | ||
nvcc --version | ||
CUDA_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | sed 's/\.//g') | ||
echo "EC_GPU_CUDA_NVCC_ARGS=--fatbin --gpu-architecture=sm_$CUDA_ARCH --generate-code=arch=compute_$CUDA_ARCH,code=sm_$CUDA_ARCH" | tee -a $GITHUB_ENV | ||
echo "CUDA_ARCH=$CUDA_ARCH" | tee -a $GITHUB_ENV | ||
echo "EC_GPU_FRAMEWORK=cuda" | tee -a $GITHUB_ENV | ||
env | grep -E "LURK|EC_GPU|CUDA" | ||
- uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: | ||
'cargo-command.env' | ||
# Checks if command starts with `cargo` | ||
- name: Run command | ||
run: | | ||
CARGO_CMD=$(echo ${{ inputs.command }} | awk '{ print $1 }') | ||
if [ "$CARGO_CMD" != "cargo" ]; | ||
then | ||
echo 'Invalid `cargo` command' | ||
exit 1 | ||
else | ||
${{ inputs.command }} | ||
fi |