From 11d17ae7f5d59b199a9042b456ee6215df1bd1b1 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 19:24:50 +0900 Subject: [PATCH 01/18] deploy: Add GitAction to automatically run test code in PR --- .github/workflows/test-on-pr.yml | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/test-on-pr.yml diff --git a/.github/workflows/test-on-pr.yml b/.github/workflows/test-on-pr.yml new file mode 100644 index 0000000..1af6510 --- /dev/null +++ b/.github/workflows/test-on-pr.yml @@ -0,0 +1,52 @@ +name: ๐Ÿš€ Run Test Code on Develop PR + +on: + pull_request: + branches: + - develop + +permissions: + contents: write + checks: write + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Code + uses: actions/checkout@v4 + + - name: ๐Ÿ”ง Set up .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: '9.0.x' + + - name: ๐Ÿ“ฆ Restore Dependencies + run: dotnet restore + + - name: ๐Ÿ—๏ธ Build Project + run: dotnet build --no-restore + + - name: ๐Ÿงช Run Tests + run: dotnet test --no-build --logger "trx;LogFileName=test_results.trx" --results-directory ./test-results --filter "TestCategory!=Integration" + + - name: ๐Ÿ”„ Convert Test Results to JUnit Format + run: | + dotnet tool install --global trx2junit + trx2junit ./test-results/test_results.trx + + - name: ๐Ÿ“‘ Publish Test Results as PR Comment + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: '**/test-results/test_results.xml' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: โœ… Add Check Comments for Failed Code Lines + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: '**/test-results/test_results.xml' + github_token: ${{ secrets.GITHUB_TOKEN }} From 2a9634b3aae51a7ec28e2078f0165d510928e2c0 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 19:27:01 +0900 Subject: [PATCH 02/18] deploy: Add build, test, and upload git action logic to develop branch --- .github/workflows/develop-push-build.yml | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/develop-push-build.yml diff --git a/.github/workflows/develop-push-build.yml b/.github/workflows/develop-push-build.yml new file mode 100644 index 0000000..2f8aba1 --- /dev/null +++ b/.github/workflows/develop-push-build.yml @@ -0,0 +1,51 @@ +name: ๐Ÿš€ Build, Test, and Upload on Develop Push + +on: + push: + branches: + - develop + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Repository + uses: actions/checkout@v4 + + - name: ๐Ÿ”ง Set Up .NET Core SDK + uses: actions/setup-dotnet@v2 + with: + dotnet-version: '9.0.x' + + - name: ๐Ÿ“ฆ Restore Dependencies + run: dotnet restore + + - name: ๐Ÿ—๏ธ Build Project + run: dotnet build --configuration Release + + - name: ๐Ÿงช Run Tests + run: dotnet test --configuration Release + + - name: ๐Ÿ“ฆ Publish Project + if: success() + run: dotnet publish --configuration Release --output ./publish + + - name: ๐Ÿ“ค Upload Artifact + if: success() + uses: actions/upload-artifact@v4 + with: + name: published-app + path: ./publish + + download-artifact: + runs-on: ubuntu-latest + needs: build + if: success() + + steps: + - name: โฌ‡๏ธ Download Artifact + uses: actions/download-artifact@v4 + with: + name: published-app + path: ./downloaded-publish From 9afbd0524e69a1a673d7756d5a3bb39a5d122253 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 19:27:36 +0900 Subject: [PATCH 03/18] =?UTF-8?q?chore:=20develop-pr-test.yml=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{test-on-pr.yml => develop-pr-test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-on-pr.yml => develop-pr-test.yml} (100%) diff --git a/.github/workflows/test-on-pr.yml b/.github/workflows/develop-pr-test.yml similarity index 100% rename from .github/workflows/test-on-pr.yml rename to .github/workflows/develop-pr-test.yml From 06b40a95494d8110be6c3675635489d18fcc43bb Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 21:27:04 +0900 Subject: [PATCH 04/18] fix: Run each test individually and install Playwright --- .github/workflows/develop-pr-test.yml | 43 +++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/develop-pr-test.yml b/.github/workflows/develop-pr-test.yml index 1af6510..cdd297b 100644 --- a/.github/workflows/develop-pr-test.yml +++ b/.github/workflows/develop-pr-test.yml @@ -29,24 +29,55 @@ jobs: - name: ๐Ÿ—๏ธ Build Project run: dotnet build --no-restore - - name: ๐Ÿงช Run Tests - run: dotnet test --no-build --logger "trx;LogFileName=test_results.trx" --results-directory ./test-results --filter "TestCategory!=Integration" + - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser + run: | + sudo apt-get install -y xvfb + nohup Xvfb :99 -ac -screen 0 1280x1024x24 & + + - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate + run: dotnet dev-certs https --trust + + - name: ๐ŸŒ Install Playwright Browsers + run: | + npm install -g playwright + npx playwright install + + - name: ๐Ÿ”ง Install Playwright CLI for .NET + run: | + dotnet tool install --global Microsoft.Playwright.CLI + playwright install + + - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests + run: dotnet test test/InterviewAssistant.Common.Tests/InterviewAssistant.Common.Tests.csproj --no-build --logger "trx;LogFileName=common_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.ApiService.Tests + run: dotnet test test/InterviewAssistant.ApiService.Tests/InterviewAssistant.ApiService.Tests.csproj --no-build --logger "trx;LogFileName=apiservice_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.Web.Tests + run: dotnet test test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj --no-build --logger "trx;LogFileName=web_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.AppHost.Tests + run: dotnet test test/InterviewAssistant.AppHost.Tests/InterviewAssistant.AppHost.Tests.csproj --no-build --logger "trx;LogFileName=apphost_tests.trx" --results-directory ./test-results + continue-on-error: true - name: ๐Ÿ”„ Convert Test Results to JUnit Format run: | dotnet tool install --global trx2junit - trx2junit ./test-results/test_results.trx + find ./test-results -name '*.trx' -exec trx2junit {} \; - name: ๐Ÿ“‘ Publish Test Results as PR Comment uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: - files: '**/test-results/test_results.xml' + files: '**/test-results/*.xml' github_token: ${{ secrets.GITHUB_TOKEN }} - name: โœ… Add Check Comments for Failed Code Lines uses: mikepenz/action-junit-report@v3 if: always() with: - report_paths: '**/test-results/test_results.xml' - github_token: ${{ secrets.GITHUB_TOKEN }} + report_paths: '**/test-results/*.xml' + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 3cea423ae20e2659f4db5822db4da0f6dec2762b Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 21:27:35 +0900 Subject: [PATCH 05/18] fix: install Playwright --- .github/workflows/develop-push-build.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/develop-push-build.yml b/.github/workflows/develop-push-build.yml index 2f8aba1..3b12e17 100644 --- a/.github/workflows/develop-push-build.yml +++ b/.github/workflows/develop-push-build.yml @@ -24,6 +24,24 @@ jobs: - name: ๐Ÿ—๏ธ Build Project run: dotnet build --configuration Release + - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser + run: | + sudo apt-get install -y xvfb + nohup Xvfb :99 -ac -screen 0 1280x1024x24 & + + - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate + run: dotnet dev-certs https --trust + + - name: ๐ŸŒ Install Playwright Browsers + run: | + npm install -g playwright + npx playwright install + + - name: ๐Ÿ”ง Install Playwright CLI for .NET + run: | + dotnet tool install --global Microsoft.Playwright.CLI + playwright install + - name: ๐Ÿงช Run Tests run: dotnet test --configuration Release @@ -31,7 +49,7 @@ jobs: if: success() run: dotnet publish --configuration Release --output ./publish - - name: ๐Ÿ“ค Upload Artifact + - name: ๐Ÿ“ค Upload Published Artifact if: success() uses: actions/upload-artifact@v4 with: @@ -44,8 +62,8 @@ jobs: if: success() steps: - - name: โฌ‡๏ธ Download Artifact + - name: โฌ‡๏ธ Download Published Artifact uses: actions/download-artifact@v4 with: name: published-app - path: ./downloaded-publish + path: ./downloaded-publish \ No newline at end of file From 004c534d625f86c10ca6cdf62e6ecc012763dbab Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 21:40:31 +0900 Subject: [PATCH 06/18] fix: Playwright downloading logic --- .github/workflows/develop-pr-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/develop-pr-test.yml b/.github/workflows/develop-pr-test.yml index cdd297b..e4c1018 100644 --- a/.github/workflows/develop-pr-test.yml +++ b/.github/workflows/develop-pr-test.yml @@ -45,6 +45,7 @@ jobs: - name: ๐Ÿ”ง Install Playwright CLI for .NET run: | dotnet tool install --global Microsoft.Playwright.CLI + dotnet tool update --global Microsoft.Playwright.CLI playwright install - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests From 9077c77a1a6a92a335de6abcd800fd8e5f88c00f Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 21:52:08 +0900 Subject: [PATCH 07/18] =?UTF-8?q?chore:=20base=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20main=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{develop-pr-test.yml => pr-test.yml} | 6 +++--- .../workflows/{develop-push-build.yml => push-build.yml} | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) rename .github/workflows/{develop-pr-test.yml => pr-test.yml} (97%) rename .github/workflows/{develop-push-build.yml => push-build.yml} (91%) diff --git a/.github/workflows/develop-pr-test.yml b/.github/workflows/pr-test.yml similarity index 97% rename from .github/workflows/develop-pr-test.yml rename to .github/workflows/pr-test.yml index e4c1018..a358c57 100644 --- a/.github/workflows/develop-pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -1,9 +1,9 @@ -name: ๐Ÿš€ Run Test Code on Develop PR +name: ๐Ÿš€ Run Test Code on PR on: pull_request: branches: - - develop + - main permissions: contents: write @@ -21,7 +21,7 @@ jobs: - name: ๐Ÿ”ง Set up .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: '9.0.x' + dotnet-version: '9.x' - name: ๐Ÿ“ฆ Restore Dependencies run: dotnet restore diff --git a/.github/workflows/develop-push-build.yml b/.github/workflows/push-build.yml similarity index 91% rename from .github/workflows/develop-push-build.yml rename to .github/workflows/push-build.yml index 3b12e17..8402951 100644 --- a/.github/workflows/develop-push-build.yml +++ b/.github/workflows/push-build.yml @@ -1,9 +1,9 @@ -name: ๐Ÿš€ Build, Test, and Upload on Develop Push +name: ๐Ÿš€ Build, Test, and Upload on Push on: push: branches: - - develop + - main jobs: build: @@ -16,7 +16,7 @@ jobs: - name: ๐Ÿ”ง Set Up .NET Core SDK uses: actions/setup-dotnet@v2 with: - dotnet-version: '9.0.x' + dotnet-version: '9.x' - name: ๐Ÿ“ฆ Restore Dependencies run: dotnet restore @@ -40,6 +40,7 @@ jobs: - name: ๐Ÿ”ง Install Playwright CLI for .NET run: | dotnet tool install --global Microsoft.Playwright.CLI + dotnet tool update --global Microsoft.Playwright.CLI playwright install - name: ๐Ÿงช Run Tests From e1837b82bd6196ccb9f2f4a7044149f7bc89f822 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 22:17:26 +0900 Subject: [PATCH 08/18] fix: dotnet build -c Release --no-restore --- .github/workflows/pr-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index a358c57..faba2e3 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -27,7 +27,7 @@ jobs: run: dotnet restore - name: ๐Ÿ—๏ธ Build Project - run: dotnet build --no-restore + run: dotnet build -c Release --no-restore - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser run: | From 0c92659482a59c9167883d1965829b8549fc3efa Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 22:21:19 +0900 Subject: [PATCH 09/18] fix: rollback --- .github/workflows/pr-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index faba2e3..a358c57 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -27,7 +27,7 @@ jobs: run: dotnet restore - name: ๐Ÿ—๏ธ Build Project - run: dotnet build -c Release --no-restore + run: dotnet build --no-restore - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser run: | From 3bf8f938da57213335c778afce44d47d495dffe5 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Sun, 16 Mar 2025 22:36:20 +0900 Subject: [PATCH 10/18] chore: upgrade actions/setup-dotnet@v4 --- .github/workflows/pr-test.yml | 2 +- .github/workflows/push-build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index a358c57..a0167eb 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: ๐Ÿ”ง Set up .NET - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v4 with: dotnet-version: '9.x' diff --git a/.github/workflows/push-build.yml b/.github/workflows/push-build.yml index 8402951..408ba88 100644 --- a/.github/workflows/push-build.yml +++ b/.github/workflows/push-build.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v4 - name: ๐Ÿ”ง Set Up .NET Core SDK - uses: actions/setup-dotnet@v2 + uses: actions/setup-dotnet@v4 with: dotnet-version: '9.x' From fc41df589f60057c23177d14f393bb5ddf6018cf Mon Sep 17 00:00:00 2001 From: gitjiho Date: Mon, 17 Mar 2025 20:50:12 +0900 Subject: [PATCH 11/18] =?UTF-8?q?refactor:=20workflow=20=ED=86=B5=ED=95=A9?= =?UTF-8?q?=20=EB=B0=8F=20=EB=B6=84=EA=B8=B0,=20playwright=20=EC=84=A4?= =?UTF-8?q?=EC=B9=98=20=EB=A1=9C=EC=A7=81=20test.csproj=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd-workflow.yml | 93 +++++++++++++++++++ .github/workflows/pr-test.yml | 84 ----------------- .github/workflows/push-build.yml | 70 -------------- .../InterviewAssistant.Web.Tests.csproj | 6 +- 4 files changed, 98 insertions(+), 155 deletions(-) create mode 100644 .github/workflows/ci-cd-workflow.yml delete mode 100644 .github/workflows/pr-test.yml delete mode 100644 .github/workflows/push-build.yml diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml new file mode 100644 index 0000000..95b991f --- /dev/null +++ b/.github/workflows/ci-cd-workflow.yml @@ -0,0 +1,93 @@ +name: ๐Ÿš€ CI/CD workflow + +on: + push: + branches: + - main + - feature/* + - feat/* + - Feat/* + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Repository + uses: actions/checkout@v4 + + - name: ๐Ÿ”ง Set Up .NET Core SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.x' + + - name: ๐Ÿ“ฆ Restore Dependencies + run: dotnet restore + + - name: ๐Ÿ—๏ธ Build Project + run: dotnet build --configuration Release + + - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate + run: dotnet dev-certs https --trust + + - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests + run: dotnet test test/InterviewAssistant.Common.Tests/InterviewAssistant.Common.Tests.csproj --configuration Release --logger "trx;LogFileName=common_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.ApiService.Tests + run: dotnet test test/InterviewAssistant.ApiService.Tests/InterviewAssistant.ApiService.Tests.csproj --configuration Release --logger "trx;LogFileName=apiservice_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.Web.Tests + run: dotnet test test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj --configuration Release --logger "trx;LogFileName=web_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿงช Run Tests for InterviewAssistant.AppHost.Tests + run: dotnet test test/InterviewAssistant.AppHost.Tests/InterviewAssistant.AppHost.Tests.csproj --configuration Release --logger "trx;LogFileName=apphost_tests.trx" --results-directory ./test-results + continue-on-error: true + + - name: ๐Ÿ”„ Convert Test Results to JUnit Format + if: github.event_name == 'pull_request' + run: | + dotnet tool install --global trx2junit + find ./test-results -name '*.trx' -exec trx2junit {} \; + + - name: ๐Ÿ“‘ Publish Test Results as PR Comment + if: github.event_name == 'pull_request' + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: '**/test-results/*.xml' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: โœ… Add Check Comments for Failed Code Lines + if: github.event_name == 'pull_request' + uses: mikepenz/action-junit-report@v3 + with: + report_paths: '**/test-results/*.xml' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿ“ฆ Publish Project + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: dotnet publish --configuration Release --output ./publish + + - name: ๐Ÿ“ค Upload Published Artifact + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: actions/upload-artifact@v4 + with: + name: published-app + path: ./publish + + download-artifact: + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + + steps: + - name: โฌ‡๏ธ Download Published Artifact + uses: actions/download-artifact@v4 + with: + name: published-app + path: ./downloaded-publish \ No newline at end of file diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml deleted file mode 100644 index a0167eb..0000000 --- a/.github/workflows/pr-test.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: ๐Ÿš€ Run Test Code on PR - -on: - pull_request: - branches: - - main - -permissions: - contents: write - checks: write - pull-requests: write - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Code - uses: actions/checkout@v4 - - - name: ๐Ÿ”ง Set up .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.x' - - - name: ๐Ÿ“ฆ Restore Dependencies - run: dotnet restore - - - name: ๐Ÿ—๏ธ Build Project - run: dotnet build --no-restore - - - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser - run: | - sudo apt-get install -y xvfb - nohup Xvfb :99 -ac -screen 0 1280x1024x24 & - - - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate - run: dotnet dev-certs https --trust - - - name: ๐ŸŒ Install Playwright Browsers - run: | - npm install -g playwright - npx playwright install - - - name: ๐Ÿ”ง Install Playwright CLI for .NET - run: | - dotnet tool install --global Microsoft.Playwright.CLI - dotnet tool update --global Microsoft.Playwright.CLI - playwright install - - - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests - run: dotnet test test/InterviewAssistant.Common.Tests/InterviewAssistant.Common.Tests.csproj --no-build --logger "trx;LogFileName=common_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.ApiService.Tests - run: dotnet test test/InterviewAssistant.ApiService.Tests/InterviewAssistant.ApiService.Tests.csproj --no-build --logger "trx;LogFileName=apiservice_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.Web.Tests - run: dotnet test test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj --no-build --logger "trx;LogFileName=web_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.AppHost.Tests - run: dotnet test test/InterviewAssistant.AppHost.Tests/InterviewAssistant.AppHost.Tests.csproj --no-build --logger "trx;LogFileName=apphost_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿ”„ Convert Test Results to JUnit Format - run: | - dotnet tool install --global trx2junit - find ./test-results -name '*.trx' -exec trx2junit {} \; - - - name: ๐Ÿ“‘ Publish Test Results as PR Comment - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: '**/test-results/*.xml' - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: โœ… Add Check Comments for Failed Code Lines - uses: mikepenz/action-junit-report@v3 - if: always() - with: - report_paths: '**/test-results/*.xml' - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/push-build.yml b/.github/workflows/push-build.yml deleted file mode 100644 index 408ba88..0000000 --- a/.github/workflows/push-build.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: ๐Ÿš€ Build, Test, and Upload on Push - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Repository - uses: actions/checkout@v4 - - - name: ๐Ÿ”ง Set Up .NET Core SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.x' - - - name: ๐Ÿ“ฆ Restore Dependencies - run: dotnet restore - - - name: ๐Ÿ—๏ธ Build Project - run: dotnet build --configuration Release - - - name: ๐Ÿ–ฅ๏ธ Set up XVFB for Headless Browser - run: | - sudo apt-get install -y xvfb - nohup Xvfb :99 -ac -screen 0 1280x1024x24 & - - - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate - run: dotnet dev-certs https --trust - - - name: ๐ŸŒ Install Playwright Browsers - run: | - npm install -g playwright - npx playwright install - - - name: ๐Ÿ”ง Install Playwright CLI for .NET - run: | - dotnet tool install --global Microsoft.Playwright.CLI - dotnet tool update --global Microsoft.Playwright.CLI - playwright install - - - name: ๐Ÿงช Run Tests - run: dotnet test --configuration Release - - - name: ๐Ÿ“ฆ Publish Project - if: success() - run: dotnet publish --configuration Release --output ./publish - - - name: ๐Ÿ“ค Upload Published Artifact - if: success() - uses: actions/upload-artifact@v4 - with: - name: published-app - path: ./publish - - download-artifact: - runs-on: ubuntu-latest - needs: build - if: success() - - steps: - - name: โฌ‡๏ธ Download Published Artifact - uses: actions/download-artifact@v4 - with: - name: published-app - path: ./downloaded-publish \ No newline at end of file diff --git a/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj b/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj index 177e9d0..b9509bf 100644 --- a/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj +++ b/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj @@ -28,4 +28,8 @@ - + + + + + \ No newline at end of file From d1f15afb5010b9d2dc16fb4ebd520fe8925189e6 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Mon, 17 Mar 2025 20:56:33 +0900 Subject: [PATCH 12/18] feat: add permissions --- .github/workflows/ci-cd-workflow.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index 95b991f..56c4a05 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -11,6 +11,11 @@ on: branches: - main +permissions: + contents: write + checks: write + pull-requests: write + jobs: build: runs-on: ubuntu-latest From c7d69bce0988990013f31fd95d7ec7f4ee989e21 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Tue, 18 Mar 2025 00:39:07 +0900 Subject: [PATCH 13/18] =?UTF-8?q?refactor:=20ci-cd-workflow=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=EB=A1=9C=EC=A7=81=20=EC=9C=84=EC=B9=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd-workflow.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index 56c4a05..1caf740 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -5,7 +5,6 @@ on: branches: - main - feature/* - - feat/* - Feat/* pull_request: branches: @@ -29,14 +28,14 @@ jobs: with: dotnet-version: '9.x' + - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate + run: dotnet dev-certs https --trust + - name: ๐Ÿ“ฆ Restore Dependencies run: dotnet restore - name: ๐Ÿ—๏ธ Build Project run: dotnet build --configuration Release - - - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate - run: dotnet dev-certs https --trust - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests run: dotnet test test/InterviewAssistant.Common.Tests/InterviewAssistant.Common.Tests.csproj --configuration Release --logger "trx;LogFileName=common_tests.trx" --results-directory ./test-results From 171493b969ea1a6404c3581f216f72abb6feb07e Mon Sep 17 00:00:00 2001 From: gitjiho Date: Tue, 18 Mar 2025 14:09:25 +0900 Subject: [PATCH 14/18] =?UTF-8?q?chore:=20=EC=9A=B4=EC=98=81=EC=B2=B4?= =?UTF-8?q?=EC=A0=9C=EB=B3=84=20=EB=B8=8C=EB=9E=9C=EC=B9=98=EB=AA=85=20?= =?UTF-8?q?=ED=98=BC=EB=9E=80=EC=9D=84=20=EB=B0=A9=EC=A7=80=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EC=9C=84=ED=95=9C=20=EB=B8=8C=EB=9E=9C=EC=B9=98?= =?UTF-8?q?=EB=AA=85=20=EC=8B=9C=EC=9E=91=20=EB=AC=B8=EC=9E=90=20=EC=86=8C?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20?= =?UTF-8?q?=EA=B9=83=EC=95=A1=EC=85=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd-workflow.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index 1caf740..a0aeb0d 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -4,8 +4,7 @@ on: push: branches: - main - - feature/* - - Feat/* + - feat/* pull_request: branches: - main From 43afe6188ceb9368de3edd45add9e56170fa5dd8 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Wed, 19 Mar 2025 00:34:17 +0900 Subject: [PATCH 15/18] =?UTF-8?q?refactor:=204=EA=B0=9C=EC=9D=98=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EA=B0=9C=EB=B3=84=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=EC=97=90=EC=84=9C=20bash=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=EB=A5=BC=20=EC=9D=B4=EC=9A=A9=ED=95=9C=20?= =?UTF-8?q?=ED=95=98=EB=82=98=EC=9D=98=20=EA=B9=83=EC=95=A1=EC=85=98=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=EC=9C=BC=EB=A1=9C=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd-workflow.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index a0aeb0d..267ae6c 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -36,21 +36,13 @@ jobs: - name: ๐Ÿ—๏ธ Build Project run: dotnet build --configuration Release - - name: ๐Ÿงช Run Tests for InterviewAssistant.Common.Tests - run: dotnet test test/InterviewAssistant.Common.Tests/InterviewAssistant.Common.Tests.csproj --configuration Release --logger "trx;LogFileName=common_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.ApiService.Tests - run: dotnet test test/InterviewAssistant.ApiService.Tests/InterviewAssistant.ApiService.Tests.csproj --configuration Release --logger "trx;LogFileName=apiservice_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.Web.Tests - run: dotnet test test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj --configuration Release --logger "trx;LogFileName=web_tests.trx" --results-directory ./test-results - continue-on-error: true - - - name: ๐Ÿงช Run Tests for InterviewAssistant.AppHost.Tests - run: dotnet test test/InterviewAssistant.AppHost.Tests/InterviewAssistant.AppHost.Tests.csproj --configuration Release --logger "trx;LogFileName=apphost_tests.trx" --results-directory ./test-results - continue-on-error: true + - name: ๐Ÿงช Run All Tests + run: | + for proj in $(find test -name "*.csproj"); do + proj_name=$(basename $proj .csproj) + dotnet test "$proj" --configuration Release --logger "trx;LogFileName=${proj_name}.trx" --results-directory ./test-results || true + done + shell: bash - name: ๐Ÿ”„ Convert Test Results to JUnit Format if: github.event_name == 'pull_request' From 222247f463435e699b98f98919e2baed85052220 Mon Sep 17 00:00:00 2001 From: gitjiho Date: Thu, 20 Mar 2025 16:14:18 +0900 Subject: [PATCH 16/18] =?UTF-8?q?Chore:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=EC=8B=9C=20Project=20=EC=83=9D=EC=84=B1,=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C,=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EB=A1=9C=EC=A7=81=20=EC=8B=A4=ED=96=89=20x=20?= =?UTF-8?q?=EB=B0=8F=20Convert=20test=20=EB=A1=9C=EC=A7=81=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd-workflow.yml | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index 267ae6c..0f56ec3 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -9,14 +9,11 @@ on: branches: - main -permissions: - contents: write - checks: write - pull-requests: write - jobs: build: runs-on: ubuntu-latest + outputs: + tests_passed: ${{ steps.test-status.outputs.tests_passed }} steps: - name: ๐Ÿง‘โ€๐Ÿ’ป Checkout Repository @@ -30,6 +27,10 @@ jobs: - name: ๐Ÿ” Trust ASP.NET Core Developer Certificate run: dotnet dev-certs https --trust + - name: ๐Ÿ› ๏ธ Install trx2junit Tool + if: github.event_name == 'pull_request' + run: dotnet tool install --global trx2junit + - name: ๐Ÿ“ฆ Restore Dependencies run: dotnet restore @@ -37,18 +38,34 @@ jobs: run: dotnet build --configuration Release - name: ๐Ÿงช Run All Tests + id: run-tests run: | + mkdir -p ./test-results + all_tests_passed=true + for proj in $(find test -name "*.csproj"); do proj_name=$(basename $proj .csproj) - dotnet test "$proj" --configuration Release --logger "trx;LogFileName=${proj_name}.trx" --results-directory ./test-results || true + if ! dotnet test "$proj" --configuration Release --logger "trx;LogFileName=${proj_name}.trx" --results-directory ./test-results; then + all_tests_passed=false + fi done + + echo "all_tests_passed=${all_tests_passed}" >> $GITHUB_OUTPUT shell: bash + - name: ๐Ÿ“Š Set Test Status + id: test-status + run: | + if [ "${{ steps.run-tests.outputs.all_tests_passed }}" == "true" ]; then + echo "tests_passed=true" >> $GITHUB_OUTPUT + else + echo "tests_passed=false" >> $GITHUB_OUTPUT + echo "โŒ Some tests failed. Deployment will be skipped." + fi + - name: ๐Ÿ”„ Convert Test Results to JUnit Format if: github.event_name == 'pull_request' - run: | - dotnet tool install --global trx2junit - find ./test-results -name '*.trx' -exec trx2junit {} \; + run: find ./test-results -name '*.trx' -exec trx2junit {} \; - name: ๐Ÿ“‘ Publish Test Results as PR Comment if: github.event_name == 'pull_request' @@ -65,11 +82,11 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} - name: ๐Ÿ“ฆ Publish Project - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.test-status.outputs.tests_passed == 'true' run: dotnet publish --configuration Release --output ./publish - name: ๐Ÿ“ค Upload Published Artifact - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.test-status.outputs.tests_passed == 'true' uses: actions/upload-artifact@v4 with: name: published-app @@ -78,7 +95,7 @@ jobs: download-artifact: runs-on: ubuntu-latest needs: build - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build.outputs.tests_passed == 'true' steps: - name: โฌ‡๏ธ Download Published Artifact From 68253e06bd3b4cd0653532b6ef4e26011c5593fc Mon Sep 17 00:00:00 2001 From: gitjiho Date: Thu, 20 Mar 2025 16:33:08 +0900 Subject: [PATCH 17/18] chore: add permissions --- .github/workflows/ci-cd-workflow.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci-cd-workflow.yml b/.github/workflows/ci-cd-workflow.yml index 0f56ec3..580868d 100644 --- a/.github/workflows/ci-cd-workflow.yml +++ b/.github/workflows/ci-cd-workflow.yml @@ -9,6 +9,11 @@ on: branches: - main +permissions: + contents: write + checks: write + pull-requests: write + jobs: build: runs-on: ubuntu-latest From e4f4434e15a2682aaf7e557587f5486004e8908b Mon Sep 17 00:00:00 2001 From: gitjiho Date: Thu, 20 Mar 2025 16:50:32 +0900 Subject: [PATCH 18/18] =?UTF-8?q?refactor:=20msBuild=20=EB=AA=85=EB=A0=B9?= =?UTF-8?q?=EC=96=B4=EB=A1=9C=20=EC=B9=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InterviewAssistant.Web.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj b/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj index b9509bf..8989fd2 100644 --- a/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj +++ b/test/InterviewAssistant.Web.Tests/InterviewAssistant.Web.Tests.csproj @@ -29,7 +29,7 @@ - + \ No newline at end of file