Schedule a run for a day #36
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
name: Schedule a run for a day | |
on: | |
workflow_dispatch: | |
inputs: | |
repo_fullname: | |
description: "Repository name" | |
required: true | |
crate: | |
description: "Crate name" | |
required: false | |
day: | |
description: "Day to run benchmarks for" | |
required: true | |
toolchain: | |
description: "Toolchain to use" | |
required: true | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Prepare the runner | |
working-directory: ./rust-runner | |
run: | | |
REPO_URL="https://github.com/${{ inputs.repo_fullname }}" | |
if [ -n "${{ inputs.crate }}" ]; then | |
cargo add --git $REPO_URL ${{ inputs.crate }} --rename solution | |
else | |
cargo add --git $REPO_URL --rename solution | |
fi | |
echo "[toolchain]" > ../rust-toolchain.toml | |
echo "channel = \"${{ inputs.toolchain }}\"" >> ../rust-toolchain.toml | |
- name: Prepare the branch & schedule the run | |
run: | | |
git config --global user.name "codspeed-advent[bot]" | |
git config --global user.email "codspeed-advent-bot@@users.noreply.github.com" | |
git add rust-runner/* rust-toolchain.toml | |
BRANCH_NAME="run/${{inputs.repo_fullname}}/${{ inputs.day }}" | |
git checkout -b $BRANCH_NAME | |
git commit -m "Run: $BRANCH_NAME" | |
git push --force origin $BRANCH_NAME | |
gh workflow run run-day.yml --ref $BRANCH_NAME --repo ${{ github.repository }} | |
env: | |
GH_TOKEN: ${{ github.token }} |