Skip to content

Commit

Permalink
GitHub super linterの利用をやめる (#623)
Browse files Browse the repository at this point in the history
* npm-run-allをインストール

* textlintを実行するスクリプトの名前を変更

* lintを全件実行するスクリプトを追加

* textlintを実行するワークフローの実装を見直し

* markdownlint-cliをインストール

* markdownlintの実行スクリプトを登録

* markdownlintの警告に対処

* markdownlintの実行をワークフローに組み込み

* yamllintのバージョンを明記

* gitignoreに記載のファイルをyamllintの検査対象から除外

* yamllintの実行スクリプトをワークフローに追加

* チェックアウトのアクションをv4に更新

* チェックアウトの深さを1に設定

* node.js v18のセットアップ処理を追加

* npm ciを使ってインストールするように変更

* ドキュメント開始のルールを無効に設定

* truthyのキーに対する検証を無効に設定

* 不要なスペースを削除

* インデントの警告に対応

* 1行スクリプトの記述方法を変更
  • Loading branch information
tsuna-can-se authored Nov 29, 2023
1 parent 146d0eb commit 51810e8
Show file tree
Hide file tree
Showing 10 changed files with 2,965 additions and 193 deletions.
121 changes: 62 additions & 59 deletions .github/workflows/build-and-release-documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: ドキュメントのビルドとリリース
on:
push:
branches: [main]
tags:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [main]
Expand Down Expand Up @@ -37,82 +37,85 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ブランチのチェックアウト
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: Linter の処理開始
- name: Node.js のセットアップ
uses: actions/setup-node@v4
with:
node-version: 18

- name: npm パッケージのインストール
run: npm ci

- name: Python のセットアップ
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: pip パッケージのインストール
run: |
echo '# Linter Result :newspaper:' >> $GITHUB_STEP_SUMMARY
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Linter の処理開始
run: echo '# Linter Result :newspaper:' >> $GITHUB_STEP_SUMMARY

- name: GitHub Super Linter の実行
id: execute_super_linter
- name: Markdownlint の実行
id: run-markdownlint
continue-on-error: true
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_INCLUDE: "documents/.*"
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: ".markdownlint.yaml"
VALIDATE_MARKDOWN: true
VALIDATE_YAML: true
YAML_CONFIG_FILE: ".yaml-lint.yml"

- name: GitHub Super Linter の結果表示
run: |
echo '## GitHub Super linter' >> $GITHUB_STEP_SUMMARY
echo '::group::super-linter.log'
cat super-linter.log
echo '::endgroup::'
LINT_MSG=$(sed '/^$/d' super-linter.log | sed -n -e '/^------/,/^------/p' | sed -n -e '/^[^-]/p' | awk '!a[$0]++{print}')
if [ -n "$LINT_MSG" ]; then
echo ':warning: エラーまたは警告が見つかりました。' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "$LINT_MSG" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo ':heavy_check_mark: 成功しました。' >> $GITHUB_STEP_SUMMARY
fi
echo '## Markdownlint Result' >> $GITHUB_STEP_SUMMARY
npx markdownlint --config .markdownlint.yaml --ignore **/node_modules/** --output markdownlint-result.txt .
echo ':heavy_check_mark: Markdownlint に成功しました。' >> $GITHUB_STEP_SUMMARY
- name: GitHub Super Linter の処理結果確認
if: ${{ steps.execute_super_linter.outcome == 'failure' }}
- name: Markdownlint 失敗時の結果表示
if: ${{ steps.run-markdownlint.outcome == 'failure' }}
run: |
exit 1
- name: npm パッケージのインストール
run: |
npm install
echo ':x: Markdownlint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat markdownlint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
- name: textlint の実行
id: execute_textlint
- name: yamllint の実行
id: run-yamllint
continue-on-error: true
run: |
echo '## textlint Result' >> $GITHUB_STEP_SUMMARY
npm run textlint-all > textlint-result.txt
echo ':heavy_check_mark: textlint に成功しました。' >> $GITHUB_STEP_SUMMARY
echo '## yamllint Result' >> $GITHUB_STEP_SUMMARY
yamllint --config-file .yaml-lint.yml --format standard . > yamllint-result.txt
echo ':heavy_check_mark: yamllint に成功しました。' >> $GITHUB_STEP_SUMMARY
- name: textlint 失敗時の結果表示
if: ${{ steps.execute_textlint.outcome == 'failure' }}
- name: yamllint 失敗時の結果表示
if: ${{ steps.run-yamllint.outcome == 'failure' }}
run: |
echo '::group::textlint-result.txt'
cat textlint-result.txt
echo '::endgroup::'
echo ':x: textlint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo ':x: yamllint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat textlint-result.txt | sed -n -e '/problems\?/p' >> $GITHUB_STEP_SUMMARY
cat yamllint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit 1
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
- name: Python のセットアップ
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: textlint の実行
run: |
echo '## textlint Result' >> $GITHUB_STEP_SUMMARY
npx textlint documents samples --output-file textlint-result.txt --format compact
if [ -f textlint-result.txt ]; then
echo ':x: textlint に失敗しました。 ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat textlint-result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'LINT_STATUS=Error' >> $GITHUB_ENV
else
echo ':heavy_check_mark: textlint に成功しました。' >> $GITHUB_STEP_SUMMARY
fi
- name: Lint 結果の確認
if: ${{ env.LINT_STATUS == 'Error' }}
run: exit 1

- name: mkdocs のインストール
run: |
python -m pip install --upgrade pip
python -m pip install mkdocs
python -m pip install mkdocs-material
python -m pip install pymdown-extensions
Expand Down Expand Up @@ -211,7 +214,7 @@ jobs:
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: ステージング環境へのデプロイ
uses: azure/webapps-deploy@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-console-app-with-di.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: ConsoleAppWithDI CI

on:
pull_request:
branches: [ main ]
branches: [main]
paths:
- 'samples/ConsoleAppWithDI/**'
- '.github/workflows/samples-console-app-with-di.ci.yml'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/samples-dressca-backend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: dressca-backend CI

on:
pull_request:
branches: [ main ]
branches: [main]
paths:
- 'samples/Dressca/dressca-backend/**'
- '.github/workflows/samples-dressca-backend.ci.yml'
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
run: |
export TEST_ENVIRONMENT=${{ env.TEST_ENVIRONMENT }}
dotnet test --no-build --logger trx --verbosity normal --configuration ${{ env.BUILD_CONFIGURATION }} --collect "XPlat Code Coverage"
- id: create-test-result-report
name: テスト結果ページの作成
uses: dorny/test-reporter@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-dressca-frontend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}'
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}'
- name: node パッケージのインストール
if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }}
run: npm install
Expand Down
6 changes: 4 additions & 2 deletions .yaml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ yaml-files:
- '*.yml'
- '.yamllint'

ignore-from-file: .gitignore

rules:
braces: enable
brackets: enable
Expand All @@ -15,8 +17,7 @@ rules:
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
document-start: disable
empty-lines: enable
empty-values: disable
hyphens: enable
Expand All @@ -30,4 +31,5 @@ rules:
quoted-strings: disable
trailing-spaces: enable
truthy:
check-keys: false
level: warning
20 changes: 10 additions & 10 deletions documents/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ nav:
- クライアントサイドレンダリング編:
- app-architecture/client-side-rendering/index.md
- フロントエンドアーキテクチャ: app-architecture/client-side-rendering/frontend-architecture.md
# - コンソールアプリケーション編:
# - app-architecture/console-app/index.md
#- クックブック:
# - cook-book/index.md
# - 帳票印刷: cook-book/report.md
# - コンソールアプリケーション編:
# - app-architecture/console-app/index.md
# - クックブック:
# - cook-book/index.md
# - 帳票印刷: cook-book/report.md
- ガイド:
- guidebooks/index.md
- Git リポジトリ構築ガイド:
Expand All @@ -44,7 +44,7 @@ nav:
- Vue.js 編:
- guidebooks/how-to-develop/vue-js/index.md
- 事前準備: guidebooks/how-to-develop/vue-js/preparation.md
- ブランクプロジェクトの作成: guidebooks/how-to-develop/vue-js/create-vuejs-blank-project.md # cspell: disable-line
- ブランクプロジェクトの作成: guidebooks/how-to-develop/vue-js/create-vuejs-blank-project.md
- ブランクプロジェクトのフォルダー構造: guidebooks/how-to-develop/vue-js/folder-structure-of-blank-project.md
- 開発に使用するパッケージ: guidebooks/how-to-develop/vue-js/optional-packages.md
- CSS の設定と CSS フレームワークの適用: guidebooks/how-to-develop/vue-js/css.md
Expand All @@ -53,17 +53,17 @@ nav:
- Open API 仕様書からのクライアントコード生成: guidebooks/how-to-develop/vue-js/create-api-client-code.md
- ローカル開発環境の構築:
- guidebooks/how-to-develop/local-environment/index.md
# - アプリケーションテスト:
# - guidebooks/app-testing/index.md
# - アプリケーションテスト:
# - guidebooks/app-testing/index.md
- マイグレーション:
- guidebooks/migration/index.md
- .NET Framework にとどまることのリスク:
- guidebooks/migration/dotnetfw-risk/index.md
- .NET ランタイムの最新動向: guidebooks/migration/dotnetfw-risk/dotnet-runtime-trends.md
- .NET Framework の開発停止によるリスク: guidebooks/migration/dotnetfw-risk/risk-of-dotnet-framework.md
- .NET への移行: guidebooks/migration/dotnetfw-risk/migration-to-dotnet.md
# - 開発プロセスのモダナイズ:
# - guidebooks/modern-dev-process/index.md
# - 開発プロセスのモダナイズ:
# - guidebooks/modern-dev-process/index.md
- サンプル解説:
- samples/index.md
- コンソールアプリケーションでの DI の利用:
Expand Down
Loading

0 comments on commit 51810e8

Please sign in to comment.