diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2e7bcade..a59589ef 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -58,7 +58,7 @@ jobs: uses: dtolnay/rust-toolchain@nightly - name: Running test script env: - DO_FMT: true + DO_FMT: false DO_BENCH: true AS_DEPENDENCY: false DO_NO_STD: true diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 00000000..4fb721e0 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,26 @@ +name: Nightly rustfmt +on: + schedule: + - cron: "0 0 * * 0" # runs weekly on Sunday at 00:00 + workflow_dispatch: # allows manual triggering +jobs: + format: + name: Nightly rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - name: Run Nightly rustfmt + run: cargo +nightly fmt + - name: Get the current date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + title: Automated nightly rustfmt (${{ env.date }}) + body: | + Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action + commit-message: ${{ env.date }} automated rustfmt nightly + labels: rustfmt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee3087ed..813c57e7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -195,12 +195,6 @@ any of the following conditions: Library reflects Bitcoin Core approach whenever possible. -### Formatting - -The repository currently uses `rustfmt` (WIP, some directories are excluded). We use nightly -features so to run the formatter use `cargo +nightly fmt`. (Remember that your editor may be -configured to fmt with a stable toolchain, this will result in many unwanted changes.) - ### Naming conventions Naming of data structures/enums and their fields/variants must follow names used