From 96b196915969eebf0dd4ed20e6611fb162ba6607 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:28:16 +0200 Subject: [PATCH] MAINT: synchronize ComPWA dev environment --- .github/workflows/ci.yml | 33 ++++++++++++++++++++ .github/workflows/clean-caches.yml | 22 ++++++++++++++ .github/workflows/pr-linting.yml | 33 ++++++++++++++++++++ .pre-commit-config.yaml | 49 ++++++++++++++++++++++++++++++ .pre-commit-hooks.yaml | 38 +++++++++++------------ .vscode/extensions.json | 9 +++++- .vscode/settings.json | 9 ++++++ Cargo.toml | 8 ++--- Dockerfile | 2 +- README.md | 2 ++ 10 files changed, 180 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/clean-caches.yml create mode 100644 .github/workflows/pr-linting.yml create mode 100644 .vscode/settings.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b1b457a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PYTHONHASHSEED: "0" + +on: + push: + branches: + - main + - epic/* + - "[0-9]+.[0-9]+.x" + pull_request: + branches: + - main + - epic/* + - "[0-9]+.[0-9]+.x" + workflow_dispatch: + inputs: + specific-pip-packages: + description: Run CI with specific pip packages + required: false + type: string + +jobs: + style: + if: inputs.specific-pip-packages == '' + secrets: + token: ${{ secrets.PAT }} + uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1 diff --git a/.github/workflows/clean-caches.yml b/.github/workflows/clean-caches.yml new file mode 100644 index 0000000..a66c407 --- /dev/null +++ b/.github/workflows/clean-caches.yml @@ -0,0 +1,22 @@ +name: Clean caches + +on: + pull_request: + types: + - closed + workflow_dispatch: + inputs: + ref: + description: Clean caches for this branch name or ref + required: false + type: string + +jobs: + cleanup: + name: Remove caches + runs-on: ubuntu-22.04 + steps: + - uses: ComPWA/actions/clean-caches@v1 + with: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ inputs.ref }} diff --git a/.github/workflows/pr-linting.yml b/.github/workflows/pr-linting.yml new file mode 100644 index 0000000..cd3bb74 --- /dev/null +++ b/.github/workflows/pr-linting.yml @@ -0,0 +1,33 @@ +name: PR linting +on: + pull_request: + types: + - edited + - labeled + - opened + - reopened + - synchronize + - unlabeled + +jobs: + check-labels: + name: Check labels + runs-on: ubuntu-22.04 + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest # cspell:ignore agilepathway + with: + any_of: >- + 🐛 Bug,✨ Feature,⚙️ Enhancement,⚠️ Interface,❗ Behavior,📝 Docs,🔨 Maintenance,🖱️ DX + none_of: Epic,💫 Good first issue + repo_token: ${{ secrets.GITHUB_TOKEN }} + + check-title: + name: Check title + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: npm install @compwa/commitlint-config + - name: Create commitlint config + run: | + echo "module.exports = {extends: ['@compwa/commitlint-config']}" > commitlint.config.js + - uses: JulienKode/pull-request-name-linter-action@v0.5.0 # cspell:ignore kode diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4300e49..2e8d0d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,54 @@ +ci: + autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks" + autoupdate_schedule: quarterly + skip: + - taplo + repos: + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-case-conflict + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-vcs-permalinks + - id: check-yaml + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + + - repo: https://github.com/ComPWA/repo-maintenance + rev: 0.1.0rc3 + hooks: + - id: check-dev-files + args: + - --ignore-author + - --no-github-actions + - --no-gitpod + - --no-prettierrc + - --no-python + - --no-version-branches + - --repo-name=mirrors-taplo + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.3 + hooks: + - id: prettier + - repo: https://github.com/ComPWA/mirrors-taplo rev: v0.8.1 hooks: - id: taplo + + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort + args: + - --in-place diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index a86957b..5828a64 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,20 +1,20 @@ - - id: taplo - name: taplo-cli - description: "A TOML toolkit written in Rust" - entry: taplo format - language: rust - types: [toml] - args: [] - require_serial: false - additional_dependencies: ["cli:taplo-cli:0.8.1"] - minimum_pre_commit_version: "0" +- id: taplo + name: taplo-cli + description: "A TOML toolkit written in Rust" + entry: taplo format + language: rust + types: [toml] + args: [] + require_serial: false + additional_dependencies: ["cli:taplo-cli:0.8.1"] + minimum_pre_commit_version: "0" - - id: taplo-docker - name: taplo-cli-docker - description: "A TOML toolkit written in Rust" - entry: tamasfe/taplo:0.8.1 - language: docker_image - types: [toml] - args: [format] - require_serial: false - minimum_pre_commit_version: "0" +- id: taplo-docker + name: taplo-cli-docker + description: "A TOML toolkit written in Rust" + entry: tamasfe/taplo:0.8.1 + language: docker_image + types: [toml] + args: [format] + require_serial: false + minimum_pre_commit_version: "0" diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 50ed5cf..1e6d142 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,8 +1,15 @@ { "recommendations": [ + "esbenp.prettier-vscode", + "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "ms-azuretools.vscode-docker", "ms-python.python", - "redhat.vscode-yaml" + "redhat.vscode-yaml", + "stkb.rewrap" + ], + "unwantedRecommendations": [ + "davidanson.vscode-markdownlint", + "travisillig.vscode-json-stable-stringify" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e34a16f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "[git-commit]": { + "editor.rulers": [72], + "rewrap.wrappingColumn": 72 + }, + "editor.formatOnSave": true, + "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], + "rewrap.wrappingColumn": 88 +} diff --git a/Cargo.toml b/Cargo.toml index 3dfeffa..e7ce0ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ -[package] -name = "__fake_crate" -version = "0.0.0" - [[bin]] name = "__fake_cmd" path = "main.rs" + +[package] +name = "__fake_crate" +version = "0.0.0" diff --git a/Dockerfile b/Dockerfile index 953e69e..fed557e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:22.04 -RUN apt-get update \ +RUN apt-get update \ && apt-get install -y \ curl \ git \ diff --git a/README.md b/README.md index 650e3cd..c04b86e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Taplo mirror +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) + Mirror of [Taplo](https://github.com/tamasfe/taplo) for [pre-commit](https://pre-commit.com), created with a modified version of [`pre-commit-mirror-maker`](https://github.com/pre-commit/pre-commit-mirror-maker) (see [this workflow](./.github/workflows/update-tags.yml)). ### Using Taplo with pre-commit