From 2aa37165d82852ea7e24263608d35e0ce0bbec5f Mon Sep 17 00:00:00 2001 From: Yuta Hayashibe Date: Fri, 14 Feb 2025 12:16:16 +0900 Subject: [PATCH] Improved CI --- .github/workflows/codeql-analysis.yml | 50 +++++++++++++-------------- .github/workflows/stale-issues.yml | 2 +- Taskfile.yml | 32 ++++++++++------- package.json | 6 ++-- 4 files changed, 48 insertions(+), 42 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d0471e4..99a094b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,34 +38,34 @@ jobs: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 91827ff..d40fec9 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -15,7 +15,7 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "This issue is stale because it has been open for 21 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." + close-issue-message: "Closed because it has been inactive for 14 days since being marked as stale." stale-issue-label: "Status: Stale" only-labels: "Type: Question" exempt-issue-labels: "Status: In Progress" diff --git a/Taskfile.yml b/Taskfile.yml index 112411e..dc2cbae 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -3,7 +3,12 @@ version: '3' tasks: default: - deps: [format, lint, test] + cmds: + - task: format + - task: lint_and_test + + lint_and_test: + deps: [lint, test] format: cmds: @@ -12,25 +17,26 @@ tasks: - pnpm format lint: - deps: [lint_yaml] - cmds: - - ruff format --respect-gitignore --check - - ruff check --respect-gitignore - - pnpm lint + deps: [lint_yaml, lint_ruff_format, lint_ruff_check, lint_pnpm] lint_yaml: cmds: - >- find . \( -name node_modules -o -name .venv \) \ - -prune -o -type f \( -name "*.yaml" -o -name "*.yml" \) -print \ - | xargs yamllint --no-warnings -c .yamllint.yml + -prune -o -type f \( -name "*.yaml" -o -name "*.yml" \) -print \ + | xargs yamllint - lint_shell: + lint_ruff_format: cmds: - - >- - find . \( -name node_modules -o -name .venv \) \ - -prune -o -type f -name '*.yml' -print \ - | xargs shellcheck + - ruff format --respect-gitignore --check + + lint_ruff_check: + cmds: + - ruff check --respect-gitignore + + lint_pnpm: + cmds: + - pnpm lint lint_typos: cmds: diff --git a/package.json b/package.json index c2025b4..c35ff46 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,12 @@ "name": "sd-webui-enable-checker", "scripts": { "preinstall": "npx only-allow pnpm", - "format": "run-s format:biome format:markdownlint format:toml", + "format": "run-p format:biome format:md format:toml", "format:biome": "biome check --write", - "format:markdownlint": "markdownlint -f ./*.md doc/*.md", + "format:md": "markdownlint -f ./*.md doc/*.md", "format:toml": "taplo format *.toml", "test": ":", - "lint": "run-s lint:biome lint:md lint:pyright lint:toml", + "lint": "run-p lint:biome lint:md lint:pyright lint:toml", "lint:biome": "biome check", "lint:md": "npx markdownlint *.md docs/*.md", "lint:pyright": "pyright",