diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 27749d4..cc1fefc 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -6,6 +6,9 @@ commitMessageLowerCase: 'never', configMigration: true, dependencyDashboard: true, + "pre-commit": { + enabled: true + }, customManagers: [ { customType: 'regex', @@ -25,6 +28,18 @@ packageNameTemplate: 'rust-lang/rust', datasourceTemplate: 'github-releases', }, + { + customType: 'regex', + managerFilePatterns: [ + '/^\\.github/workflows/pre-commit.yml$/', + ], + matchStrings: [ + 'prek-version.*?(?\\d+\\.\\d+(\\.\\d+)?)', + ], + depNameTemplate: 'prek', + packageNameTemplate: 'j178/prek', + datasourceTemplate: 'github-releases', + }, ], packageRules: [ { @@ -41,6 +56,20 @@ ], automerge: true, }, + { + commitMessageTopic: 'Prek', + matchManagers: [ + 'custom.regex', + ], + matchDepNames: [ + 'prek', + ], + extractVersion: '^(?\\d+\\.\\d+\\.\\d+)', + schedule: [ + '* * * * *', + ], + automerge: true, + }, // Goals: // - Keep version reqs low, ignoring compatible normal/build dependencies // - Take advantage of latest dev-dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2168bb8..9aa2f13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,7 +133,7 @@ jobs: components: rustfmt - uses: Swatinem/rust-cache@v2 - name: Check formatting - run: cargo fmt --all -- --check + run: cargo fmt --check clippy: name: clippy runs-on: ubuntu-latest diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a923ba0..98a7546 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -23,7 +23,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: j178/prek-action@v1 with: - python-version: '3.x' - - uses: pre-commit/action@v3.0.1 + prek-version: '0.2.27' diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml new file mode 100644 index 0000000..1d4fd85 --- /dev/null +++ b/.github/workflows/template.yml @@ -0,0 +1,58 @@ +name: Template Update + +permissions: + contents: read + +on: + schedule: + - cron: '1 1 1 * *' + workflow_dispatch: + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + TEMPLATE_URL: "https://github.com/epage/_rust.git" + TEMPLATE_BRANCH: "main" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + update: + permissions: + security-events: write # to create PR + pull-requests: write + contents: write # to push the branch + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Configure git + run: | + git config --global user.name '${{ github.actor }}' + git config --global user.email '<>' + - name: Fetch template + run: "git remote add template ${{ env.TEMPLATE_URL }} && git fetch template ${{ env.TEMPLATE_BRANCH }}" + - name: Merge template + run: "git checkout -b template-update && git merge template/${{ env.TEMPLATE_BRANCH }} -m 'chore: Update from template'" + - name: Clear any existing branch + run: "git push origin --delete template-update" + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + - name: Push branch + run: "git push --set-upstream origin template-update" + env: + GH_TOKEN: ${{ github.token }} + - name: Create PR + run: "gh pr create --head template-update --title 'chore: Update from template' --body ''" + env: + GH_TOKEN: ${{ github.token }} + - name: Merge PR + run: "gh pr merge --auto --delete-branch" + env: + GH_TOKEN: ${{ github.token }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 656c68e..7aa56f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ default_install_hook_types: ["pre-commit", "commit-msg"] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-yaml - id: check-json @@ -10,10 +10,10 @@ repos: - id: check-case-conflict - id: detect-private-key - repo: https://github.com/crate-ci/typos - rev: v1.32.0 + rev: v1.42.1 hooks: - id: typos - repo: https://github.com/crate-ci/committed - rev: v1.1.7 + rev: v1.1.10 hooks: - id: committed diff --git a/Cargo.toml b/Cargo.toml index 50e38da..c241eb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ create_dir = "warn" dbg_macro = "warn" debug_assert_with_mut_call = "warn" doc_markdown = "warn" -empty_enum = "warn" +empty_enums = "warn" enum_glob_use = "warn" expl_impl_clone_on_copy = "warn" explicit_deref_methods = "warn"