ci: fix the update-models workflow
This commit is contained in:
1 file changed
+52
-54
@@ -6,7 +6,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: update-models
|
group: update-models
|
||||||
@@ -26,67 +26,65 @@ jobs:
|
|||||||
RUSTFLAGS: --deny warnings
|
RUSTFLAGS: --deny warnings
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: true
|
ssh-key: ${{ secrets.RELEASE_BOT_SSH_KEY }}
|
||||||
|
persist-credentials: true
|
||||||
|
|
||||||
- name: Install Rust Toolchain Components
|
- name: Install Rust Toolchain Components
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Cache DuckDB Extensions
|
- name: Cache DuckDB Extensions
|
||||||
id: duckdb-extensions
|
id: duckdb-extensions
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.duckdb/extensions
|
path: ~/.duckdb/extensions
|
||||||
key: duckdb-ext-ubuntu-latest-${{ hashFiles('Cargo.lock') }}
|
key: duckdb-ext-ubuntu-latest-${{ hashFiles('Cargo.lock') }}
|
||||||
|
|
||||||
- name: Install DuckDB Extensions
|
- name: Install DuckDB Extensions
|
||||||
if: steps.duckdb-extensions.outputs.cache-hit != 'true'
|
if: steps.duckdb-extensions.outputs.cache-hit != 'true'
|
||||||
run: cargo test --all duckdb
|
run: cargo test --all duckdb
|
||||||
|
|
||||||
- name: Write stub config
|
- name: Write stub config
|
||||||
run: |
|
run: |
|
||||||
COYOTE_CONFIG_DIR="$(mktemp -d)"
|
COYOTE_CONFIG_DIR="$(mktemp -d)"
|
||||||
printf 'clients:\n - type: openai\n - type: claude\n' > "$COYOTE_CONFIG_DIR/config.yaml"
|
printf 'clients:\n - type: openai\n - type: claude\n' > "$COYOTE_CONFIG_DIR/config.yaml"
|
||||||
echo "COYOTE_CONFIG_DIR=$COYOTE_CONFIG_DIR" >> "$GITHUB_ENV"
|
echo "COYOTE_CONFIG_DIR=$COYOTE_CONFIG_DIR" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Regenerate model catalog
|
- name: Regenerate model catalog
|
||||||
run: cargo run --release -- --generate-models
|
run: cargo run --release -- --generate-models
|
||||||
|
|
||||||
- name: Detect catalog changes
|
- name: Detect catalog changes
|
||||||
id: diff
|
id: diff
|
||||||
run: echo "changed=$(git diff --quiet models.yaml && echo false || echo true)" >> "$GITHUB_OUTPUT"
|
run: echo "changed=$(git diff --quiet models.yaml && echo false || echo true)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# The binary built by the regeneration step embedded the OLD models.yaml (the file
|
# The binary built by the regeneration step embedded the OLD models.yaml (the file
|
||||||
# was rewritten after that build), so rebuild before smoke-testing: cargo tracks
|
# was rewritten after that build), so rebuild before smoke-testing: cargo tracks
|
||||||
# include_str! inputs, making this a cheap incremental rebuild of the final crate.
|
# include_str! inputs, making this a cheap incremental rebuild of the final crate.
|
||||||
- name: Rebuild with the refreshed catalog
|
- name: Rebuild with the refreshed catalog
|
||||||
if: steps.diff.outputs.changed == 'true'
|
if: steps.diff.outputs.changed == 'true'
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
if: steps.diff.outputs.changed == 'true'
|
if: steps.diff.outputs.changed == 'true'
|
||||||
run: cargo test --all
|
run: cargo test --all
|
||||||
|
|
||||||
- name: Smoke test the refreshed catalog
|
- name: Smoke test the refreshed catalog
|
||||||
if: steps.diff.outputs.changed == 'true'
|
if: steps.diff.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
COUNT=$(./target/release/coyote --list-models | wc -l)
|
COUNT=$(./target/release/coyote --list-models | wc -l)
|
||||||
echo "Listed $COUNT chat models"
|
echo "Listed $COUNT chat models"
|
||||||
test "$COUNT" -ge 40
|
test "$COUNT" -ge 40
|
||||||
|
|
||||||
# Pushes made with the default GITHUB_TOKEN do not trigger other workflows,
|
- name: Commit and push
|
||||||
# so this push cannot start a workflow loop. The pull --rebase covers a human
|
if: steps.diff.outputs.changed == 'true'
|
||||||
# push landing mid-run; if the race is lost anyway, the next cron run retries.
|
run: |
|
||||||
- name: Commit and push
|
git add models.yaml
|
||||||
if: steps.diff.outputs.changed == 'true'
|
git checkout -- .
|
||||||
run: |
|
git config user.name 'github-actions[bot]'
|
||||||
git add models.yaml
|
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||||
git checkout -- .
|
git commit -m 'chore: refresh generated model catalog [skip ci]'
|
||||||
git config user.name 'github-actions[bot]'
|
git pull --rebase origin main
|
||||||
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
git push origin main
|
||||||
git commit -m 'chore: refresh generated model catalog'
|
|
||||||
git pull --rebase origin main
|
|
||||||
git push origin main
|
|
||||||
Reference in new issue
Block a user