Skip to content

Commit 7b2cf02

Browse files
authored
Use Rust Diff Check Binary in CI (#6770)
* remove `ci/check_diff.sh ` No longer needed since we're moving to the rust version. * call the rust check_diff binary from `.github/workflows/check_diff.yml` Now we're calling our rust binary instead of our old shell script. * add `language_edition` and `style_edition` to `check_diff.yml` CI This will let us test the `check_diff` binary with different combinations of Rust language edition and rustfmt style_edition.
1 parent 75d056a commit 7b2cf02

2 files changed

Lines changed: 40 additions & 256 deletions

File tree

.github/workflows/check_diff.yml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ on:
88
branch_name:
99
description: 'Name of the feature branch on the forked repo'
1010
required: true
11+
language_edition:
12+
description: 'Rust language `edition` used to parse code'
13+
required: true
14+
default: 2015
15+
type: choice
16+
options:
17+
- 2015
18+
- 2018
19+
- 2021
20+
- 2024
21+
style_edition:
22+
description: 'rustfmt `style_edition` used when formatting code.'
23+
required: true
24+
default: 2021
25+
type: choice
26+
options:
27+
- 2021 # 2015, 2018, and 2021 are all formatted the same since `style_edition` was added between 2021 and 2024
28+
- 2024
1129
commit_hash:
1230
description: 'Optional commit hash from the feature branch'
1331
required: false
@@ -23,11 +41,27 @@ jobs:
2341
- name: checkout
2442
uses: actions/checkout@v4
2543

26-
- name: install rustup
44+
- name: Build check_diff binary
45+
working-directory: ./check_diff
46+
run: cargo build --release
47+
48+
- name: Run Diff Check
49+
working-directory: ./check_diff
50+
env:
51+
CHECK_DIFF_LOG: info
52+
shell: bash
2753
run: |
28-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
29-
sh rustup-init.sh -y --default-toolchain none
30-
rustup target add x86_64-unknown-linux-gnu
54+
OPTIONS=""
55+
56+
if [[ -n "${{ github.event.inputs.commit_hash }}" ]]; then
57+
OPTIONS+="--commit-hash ${{ github.event.inputs.commit_hash }} "
58+
fi
59+
60+
if [[ -n "${{ github.event.inputs.rustfmt_configs }}" ]]; then
61+
OPTIONS+="--rustfmt-config ${{ github.event.inputs.rustfmt_configs }} "
62+
fi
3163
32-
- name: check diff
33-
run: bash ${GITHUB_WORKSPACE}/ci/check_diff.sh ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} ${{ github.event.inputs.commit_hash || github.event.inputs.branch_name }} ${{ github.event.inputs.rustfmt_configs }}
64+
target/release/check_diff ${{ github.event.inputs.clone_url }} ${{ github.event.inputs.branch_name }} \
65+
--edition ${{ github.event.inputs.language_edition }} \
66+
--style-edition ${{ github.event.inputs.style_edition }} \
67+
$OPTIONS

ci/check_diff.sh

Lines changed: 0 additions & 250 deletions
This file was deleted.

0 commit comments

Comments
 (0)