Skip to content

Commit

Permalink
Merge branch 'main' into feature/改行コードを標準化する
Browse files Browse the repository at this point in the history
  • Loading branch information
1nu1taichi committed Nov 17, 2023
2 parents 4c6f202 + fd9187f commit 35c0a85
Show file tree
Hide file tree
Showing 43 changed files with 3,394 additions and 2,433 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
commit-message:
prefix: "npm-root"
labels:
Expand All @@ -14,6 +15,7 @@ updates:
directory: "/samples/Dressca/dressca-frontend"
schedule:
interval: "daily"
open-pull-requests-limit: 10
commit-message:
prefix: "npm-dressca-frontend"
labels:
Expand All @@ -24,6 +26,7 @@ updates:
directory: "/samples/Dressca/dressca-backend"
schedule:
interval: "daily"
open-pull-requests-limit: 10
commit-message:
prefix: "nuget-dressca"
labels:
Expand All @@ -34,6 +37,7 @@ updates:
directory: "/samples/ConsoleAppWithDI/solution"
schedule:
interval: "daily"
open-pull-requests-limit: 10
commit-message:
prefix: "nuget-console-app-with-di"
labels:
Expand Down
56 changes: 40 additions & 16 deletions .github/workflows/build-and-release-documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ on:
- "package.json"
workflow_dispatch:

permissions:
id-token: write
contents: write

env:
APP_OSS_MARIS_WEBAPP_NAME: app-oss-maris
APP_ALESINFINY_MARIS_WEBAPP_NAME: app-alesinfiny-maris-docs-prod
DOCUMENT_ARTIFACTS_FILENAME: docs.zip

jobs:
Expand Down Expand Up @@ -114,6 +118,16 @@ jobs:
python -m pip install pymdown-extensions
python -m pip install mkdocs-minify-plugin
- name: dressca.zip の作成
run: |
cd samples/Dressca
zip -r ../../documents/contents/samples/downloads/dressca.zip *
- name: console-app-with-di.zip の作成
run: |
cd samples/ConsoleAppWithDI
zip -r ../../documents/contents/samples/downloads/console-app-with-di.zip *
- name: ドキュメントのビルド
id: build_documents
continue-on-error: true
Expand All @@ -124,27 +138,31 @@ jobs:
else
export VERSION="Test Version"
fi
cd samples/Dressca
zip -r ../../documents/contents/samples/downloads/dressca.zip *
cd ../ConsoleAppWithDI
zip -r ../../documents/contents/samples/downloads/console-app-with-di.zip *
cd ../../documents
cd documents
echo '# Mkdocs Build Result :factory:' >> $GITHUB_STEP_SUMMARY
mkdocs build --verbose --clean --strict > mkdocs_build_log.txt
if [ $? = 0 ]; then
echo ':heavy_check_mark: mkdocs のビルドに成功しました。' >> $GITHUB_STEP_SUMMARY
else
echo ':x: mkdocs のビルドに失敗しました。' >> $GITHUB_STEP_SUMMARY
fi
- name: ドキュメントビルドの結果表示(成功)
if: ${{ steps.build_documents.outcome == 'success' }}
run: |
echo ':heavy_check_mark: mkdocs のビルドに成功しました。' >> $GITHUB_STEP_SUMMARY
cd documents
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: ドキュメントビルドの処理結果確認
- name: ドキュメントビルドの結果表示(失敗)
if: ${{ steps.build_documents.outcome == 'failure' }}
run: |
echo ':x: mkdocs のビルドに失敗しました。' >> $GITHUB_STEP_SUMMARY
cd documents
if [ -s mkdocs_build_log.txt ]; then
echo '```' >> $GITHUB_STEP_SUMMARY
cat mkdocs_build_log.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
exit 1
- name: IIS 用のファイル配置とパッケージング
Expand Down Expand Up @@ -188,18 +206,24 @@ jobs:
with:
name: documents

- name: Azure に OIDC Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: ステージング環境へのデプロイ
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.APP_OSS_MARIS_WEBAPP_NAME }}
app-name: ${{ env.APP_ALESINFINY_MARIS_WEBAPP_NAME }}
slot-name: staging
publish-profile: ${{ secrets.APP_OSS_MARIS_STAGING_PUBLISH_PROFILE }}
package: "${{ env.DOCUMENT_ARTIFACTS_FILENAME }}"

- name: Teams への通知
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.POST_MESSAGE_TO_TEAMS_URL }}
url: ${{ secrets.ALESINFINY_POST_MESSAGE_TO_TEAMS_URL }}
method: POST
contentType: application/json
data: '{"messageType": 0,"branchName": "${{ github.ref }}","actor": "${{ github.actor }}","sha": "${{ github.sha }}","eventName": "${{ github.event_name }}"}'
Expand All @@ -214,7 +238,7 @@ jobs:
- name: 本番環境への反映承認
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.APPROVE_REQUEST_TO_TEAMS_URL }}
url: ${{ secrets.ALESINFINY_APPROVE_REQUEST_TO_TEAMS_URL }}
method: POST
contentType: application/json
data: '{"branchName": "${{ github.ref }}","actor": "${{ github.actor }}","sha": "${{ github.sha }}","eventName": "${{ github.event_name }}"}'
Expand Down
115 changes: 100 additions & 15 deletions .github/workflows/samples-dressca-backend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- '.github/workflows/samples-dressca-backend.ci.yml'
workflow_dispatch:

env:
WORKING_DIRECTORY: samples/Dressca/dressca-backend

defaults:
run:
working-directory: samples/Dressca/dressca-backend
Expand All @@ -23,6 +26,12 @@ jobs:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
BUILD_CONFIGURATION: Debug
BUILD_SUMMARY_FILE: BuildSummary.md
TEST_ENVIRONMENT: IntegrationTest
permissions:
checks: write
contents: read
pull-requests: write

steps:
- name: ブランチのチェックアウト
Expand All @@ -39,21 +48,97 @@ jobs:
- name: NuGet パッケージの復元
run: dotnet restore

- name: アプリケーションのビルド
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }}
- id: application-build
name: アプリケーションのビルド
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} --verbosity minimal > build-result.txt

- name: 単体テストの実行
- name: ビルド結果の表示
shell: bash
if: ${{ success() || (failure() && steps.application-build.conclusion == 'failure') }}
run: |
dotnet add tests/Dressca.UnitTests/Dressca.UnitTests.csproj package coverlet.msbuild
dotnet test --no-build --verbosity normal --configuration ${{ env.BUILD_CONFIGURATION }} /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov > testResult.txt
echo '# Build Result :gear:' >> $GITHUB_STEP_SUMMARY
cat testResult.txt | sed -n -e '/Done/,/Elapsed/p' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '# Test Result :memo:' >> $GITHUB_STEP_SUMMARY
cat testResult.txt | sed -n -e '/A total of/,/Passed/p' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '# Coverage :triangular_ruler:' >> $GITHUB_STEP_SUMMARY
cat testResult.txt | sed -n -e '/+----------------------------------+--------+--------+--------+/,/+---------+--------+--------+--------+/p' | sed -e '$d' | sed -e '$d' | sed -e '$d' | sed -e '/+----------------------------------+--------+--------+--------+/d' | sed -e 's/|//' | sed -e 's/|*$//g' | sed -e '1d' | sed -e '1i --------------------------|--------|--------|------------------' | sed -e '1i Module | Line | Branch | Method' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
cat testResult.txt | sed -n -e '/+---------+--------+--------+--------+/,/Average/p' | sed -e '1,2d' | sed -e '/+---------+--------+--------+--------+/d' | sed -e 's/|//' | sed -e 's/|*$//g' | sed -e '1i ----------|--------|--------|---------' | sed -e '1i --- | Line | Branch | Method' | sed -e '$d' | sed -e '$d' | sed -e '$d' | sed -e '$d' | sed -e '$d' | sed -e '$d' | sed -e '$d' >> $GITHUB_STEP_SUMMARY
cat build-result.txt | sed -n -e 's/^/> /p' >> $GITHUB_STEP_SUMMARY
- name: SQL ServerのDockerイメージをプル(結合テスト用)
run: sudo docker pull mcr.microsoft.com/mssql/server:2022-latest

- name: SQL Serverのコンテナを起動(結合テスト用)
run: |
sudo docker run -e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=P@ssw0rd" \
-p 1433:1433 --name sql1 \
--hostname sql1 \
-d mcr.microsoft.com/mssql/server:2022-latest
- name: データベース接続文字列を取得(結合テスト用)
id: get-connection-string
env:
APPSETTINGS_FILEPATH: tests/Dressca.IntegrationTest/appsettings.${{ env.TEST_ENVIRONMENT }}.json
run: |
connectionString=$(cat ${{env.APPSETTINGS_FILEPATH}} | jq '.ConnectionStrings.DresscaDbContext')
echo "CONNECTION_STRING=${connectionString}" >> "$GITHUB_OUTPUT"
- name: EF Core ツールのインストール(結合テスト用)
shell: bash
run: dotnet tool install --global dotnet-ef --version 6.*

- name: マイグレーション適用(結合テスト用)
working-directory: ${{ env.WORKING_DIRECTORY }}/src/Dressca.EfInfrastructure
shell: bash
run: dotnet ef database update --connection ${{ steps.get-connection-string.outputs.CONNECTION_STRING }}

- id: run-tests
name: テストの実行
continue-on-error: true
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
if: ${{ success() || (failure() && steps.run-tests.conclusion == 'failure') }}
with:
name: 'Test results'
path: '**/TestResults/*.trx'
path-replace-backslashes: 'true'
reporter: 'dotnet-trx'
only-summary: 'false'
list-suites: 'all'
list-tests: 'all'
max-annotations: '10'
fail-on-error: 'true'

- name: テスト結果のサマリー表示
shell: bash
if: ${{ success() || (failure() && steps.run-tests.conclusion == 'failure') }}
run: |
echo '## Test Result :memo:' >> ${{ env.BUILD_SUMMARY_FILE }}
echo 'Test was a **${{ steps.create-test-result-report.outputs.conclusion }}**.' >> ${{ env.BUILD_SUMMARY_FILE }}
echo 'Completed in ${{ steps.create-test-result-report.outputs.time }}ms with **${{ steps.create-test-result-report.outputs.passed }}** passed, **${{ steps.create-test-result-report.outputs.failed }}** failed and ${{ steps.create-test-result-report.outputs.skipped }} skipped.' >> ${{ env.BUILD_SUMMARY_FILE }}
cat ${{ env.BUILD_SUMMARY_FILE }} >> $GITHUB_STEP_SUMMARY
- id: create-coverage-report
name: コードカバレッジレポートの解析と作成
uses: danielpalme/ReportGenerator-GitHub-Action@5
if: ${{ success() || (failure() && steps.run-tests.conclusion == 'failure') }}
with:
reports: '**/TestResults/*/coverage.cobertura.xml'
targetdir: '${{ env.WORKING_DIRECTORY }}/CoverageReport'
reporttypes: 'MarkdownSummaryGithub'

- name: コードカバレッジの結果表示
shell: bash
if: ${{ success() || (failure() && steps.run-tests.conclusion == 'failure') }}
run: |
sed -i s/'# Summary'/'## Coverage :triangular_ruler:'/g CoverageReport/SummaryGithub.md
sed -i -e '/^## Coverage$/d' CoverageReport/SummaryGithub.md
cat CoverageReport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
cat CoverageReport/SummaryGithub.md >> ${{ env.BUILD_SUMMARY_FILE }}
- name: ビルドサマリーをPull-requestに表示
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name == 'pull_request' && (success() || (failure() && steps.run-tests.conclusion == 'failure')) }}
with:
recreate: true
path: '${{ env.WORKING_DIRECTORY }}/${{ env.BUILD_SUMMARY_FILE }}'
2 changes: 1 addition & 1 deletion documents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 本番環境

<https://wwww.marisossedition.org>
<https://maris.alesinfiny.org/>

## フォルダー構造

Expand Down
Loading

0 comments on commit 35c0a85

Please sign in to comment.