Skip to content

Commit

Permalink
feat: Add sync-toolchains workflow (#3)
Browse files Browse the repository at this point in the history
* 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
fuzzypixelz authored Jun 13, 2024
1 parent ac17b3a commit 50346f1
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/sync-toolchains.yml
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 }}

0 comments on commit 50346f1

Please sign in to comment.