Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/actions/rust-env-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Prepare CI Rust environment"
description: "Installs rust, protoc, just, some other stuff too"
runs:
using: "composite"
steps:
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""
cache: false

- name: Setup Rust Caching
uses: WarpBuilds/rust-cache@v2 # a fork of Swatinem/rust-cache@v2 that uses warpbuild cache
with:
cache-on-failure: "true"

- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari

- name: Disable hakari
run: cargo hakari disable
shell: bash

- name: Install protoc
uses: ./.github/actions/install-protoc

- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.98

- name: Setup just
uses: extractions/setup-just@v3
34 changes: 2 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,8 @@ jobs:

- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""
cache: false

- name: Setup Rust Caching
uses: WarpBuilds/rust-cache@v2 # a fork of Swatinem/rust-cache@v2 that uses warpbuild cache
with:
cache-on-failure: "true"

- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari

- name: Disable hakari
run: cargo hakari disable

- name: Install protoc
uses: ./.github/actions/install-protoc

- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@0.9.98

- name: Setup just
uses: extractions/setup-just@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup CI environment
uses: ./.github/actions/rust-env-setup

- name: Check Cargo.lock file is updated
run: cargo update -w --locked
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/fmt-slash-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Fmt slash command
on:
repository_dispatch:
types: [fmt-command]
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
ref: ${{ steps.vars.outputs.branch }}

- name: Setup CI environment
uses: ./.github/actions/rust-env-setup

- name: Run format
run: just fmt

- name: Commit and push changes (if any)
shell: bash
env:
CI_COMMIT_MESSAGE: Update template
CI_COMMIT_AUTHOR: github-actions[bot]
CI_COMMIT_EMAIL: username@users.noreply.github.com
run: |
cd destination
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
if [[ `git status --porcelain --untracked-files=no` ]]; then
# Changes
git add .
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
else
# No changes
echo "no changes to the destination"
exit 0
fi

# Add reaction to the comment
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: hooray
49 changes: 49 additions & 0 deletions .github/workflows/rebase-slash-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: rebase-command
on:
repository_dispatch:
types: [rebase-command]
jobs:
rebase:
if: github.event.client_payload.pull_request.rebaseable == true
runs-on: ubuntu-latest
steps:
- name: Checkout pull request
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
fetch-depth: 0

- name: Rebase
run: |
git config --global user.name '${{ github.event.client_payload.github.actor }}'
git config --global user.email '${{ github.event.client_payload.github.actor }}@users.noreply.github.com'
git remote add base https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.event.client_payload.pull_request.base.repo.full_name }}.git
git fetch base ${{ github.event.client_payload.pull_request.base.ref }}
git rebase base/${{ github.event.client_payload.pull_request.base.ref }}
git push --force-with-lease

- name: Update comment
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
>Pull request successfully rebased
reactions: hooray

notRebaseable:
if: github.event.client_payload.pull_request.rebaseable != true
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
>Pull request is not rebaseable
reactions: hooray
16 changes: 16 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ secrets.PAT }}
commands: |
fmt
rebase

Loading