Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
11d17ae
deploy: Add GitAction to automatically run test code in PR
GitJIHO Mar 16, 2025
2a9634b
deploy: Add build, test, and upload git action logic to develop branch
GitJIHO Mar 16, 2025
9afbd05
chore: develop-pr-test.yml 이름 변경
GitJIHO Mar 16, 2025
06b40a9
fix: Run each test individually and install Playwright
GitJIHO Mar 16, 2025
3cea423
fix: install Playwright
GitJIHO Mar 16, 2025
004c534
fix: Playwright downloading logic
GitJIHO Mar 16, 2025
9077c77
chore: base 브랜치를 main으로 변경
GitJIHO Mar 16, 2025
e1837b8
fix: dotnet build -c Release --no-restore
GitJIHO Mar 16, 2025
0c92659
fix: rollback
GitJIHO Mar 16, 2025
3bf8f93
chore: upgrade actions/setup-dotnet@v4
GitJIHO Mar 16, 2025
fc41df5
refactor: workflow 통합 및 분기, playwright 설치 로직 test.csproj 내부 설정
GitJIHO Mar 17, 2025
d1f15af
feat: add permissions
GitJIHO Mar 17, 2025
c7d69bc
refactor: ci-cd-workflow 내부 로직 위치 변경
GitJIHO Mar 17, 2025
171493b
chore: 운영체제별 브랜치명 혼란을 방지하기 위한 브랜치명 시작 문자 소문자로 변경 및 깃액션 적용
GitJIHO Mar 18, 2025
43afe61
refactor: 4개의 테스트 개별 실행에서 bash 스크립트를 이용한 하나의 깃액션 로직으로 통일
GitJIHO Mar 18, 2025
222247f
Chore: 테스트 실패시 Project 생성, 업로드, 다운로드 로직 실행 x 및 Convert test 로직 분리
GitJIHO Mar 20, 2025
68253e0
chore: add permissions
GitJIHO Mar 20, 2025
e4f4434
refactor: msBuild 명령어로 치환
GitJIHO Mar 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/ci-cd-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: 🚀 CI/CD workflow

on:
push:
branches:
- main
- feat/*
pull_request:
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
uses: actions/checkout@v4

- name: 🔧 Set Up .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'

- 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

- name: 🏗️ Build Project
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)
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: 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' && 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' && steps.test-status.outputs.tests_passed == 'true'
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' && needs.build.outputs.tests_passed == 'true'

steps:
- name: ⬇️ Download Published Artifact
uses: actions/download-artifact@v4
with:
name: published-app
path: ./downloaded-publish
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@
<ProjectReference Include="..\..\src\InterviewAssistant.Web\InterviewAssistant.Web.csproj" />
</ItemGroup>

</Project>
<Target Name="InstallPlaywright" AfterTargets="Build">
<Exec Command="pwsh $(ProjectDir)/bin/$(Configuration)/$(TargetFramework)/playwright.ps1 install" />
</Target>

</Project>