forked from eclipse-zenoh/ci
-
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.
feat: Add sync-toolchains workflow (#3)
* feat: Add sync-toolchains workflow * feat: Use Rust toolchain version from input * feat: Customize base branch * fix: Extend workflow to eclipse-zenoh/zenoh
- Loading branch information
1 parent
ac17b3a
commit 50346f1
Showing
1 changed file
with
77 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,77 @@ | ||
name: Sync Rust toolchains | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # At the end of every day | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Rust toolchain version (e.g. "1.76") | ||
type: string | ||
required: true | ||
branch: | ||
description: Target branch (e.g. "main") | ||
type: string | ||
required: false | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
sync: | ||
name: Update Rust toolchain | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dependant: | ||
- zenoh | ||
- zenoh-c | ||
- zenoh-python | ||
- zenoh-java | ||
- zenoh-kotlin | ||
- zenoh-plugin-dds | ||
- zenoh-plugin-mqtt | ||
- zenoh-plugin-ros1 | ||
- zenoh-plugin-ros2dds | ||
- zenoh-plugin-webserver | ||
- zenoh-backend-filesystem | ||
- zenoh-backend-influxdb | ||
- zenoh-backend-rocksdb | ||
- zenoh-backend-s3 | ||
steps: | ||
- name: Clone ${{ matrix.dependant }} | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: eclipse-zenoh/${{ matrix.dependant }} | ||
ref: ${{ inputs.branch }} | ||
|
||
- name: Update ${{ matrix.dependant }}'s Rust toolchain to ${{ inputs.version }} | ||
run: sed "s;^channel = .*\$;channel = \"${{ inputs.version }}\";" --in-place rust-toolchain.toml | ||
shell: bash | ||
|
||
- name: Create/Update a pull request if the toolchain changed | ||
id: cpr | ||
# NOTE: If there is a pending PR, this action will simply update it with a forced push. | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
title: Sync Rust toolchain | ||
body: > | ||
Automated update of the Rust toolchain defined in `rust-toolchain.tml`. The Rust | ||
toolchain should be pinned in all eclipse-zenoh crates to ensure ABI compatibility for | ||
plugins and backends. | ||
commit-message: "chore: Sync Rust toolchain" | ||
committer: eclipse-zenoh-bot <[email protected]> | ||
author: eclipse-zenoh-bot <[email protected]> | ||
branch: eclipse-zenoh-bot/sync-toolchain | ||
base: ${{ inputs.branch }} | ||
delete-branch: true | ||
labels: dependencies | ||
token: ${{ secrets.BOT_TOKEN_WORKFLOW }} | ||
|
||
- name: Enable auto merge for the pull request | ||
if: steps.cpr.outputs.pull-request-operation == 'created' | ||
run: | ||
gh pr merge -R "eclipse-zenoh/${{ matrix.dependant }}" --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_TOKEN_WORKFLOW }} |