last #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release | |
| on: # 실행 조건 | |
| push: | |
| branches: [ main ] # main branch에 push되면 실행 | |
| pull_request: | |
| branches: [ main ] # PR이 main으로 열리면 실행 | |
| workflow_dispatch: | |
| release: | |
| types: [created] # git tag 로 release 생성 시 실행 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # 실행 환경 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 # 현재 레포의 코드를 가져옴 | |
| - name: Set up .NET (for C#) # C#을 위해서 환경 세팅 | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '7.0.x' | |
| - name: Set up Java (for Kotlin) # Kotlin을 위해서 환경 세팅 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Install Eigen | |
| run: sudo apt update && sudo apt install -y libeigen3-dev | |
| - name: Build C++ project # c++ 컴파일 | |
| run: | | |
| mkdir -p assignment_4/output_cpp | |
| g++ -I /usr/include/eigen3 assignment_4/c++/*.cpp -o assignment_4/output_cpp/cpp_program | |
| chmod +x assignment_4/output_cpp/cpp_program | |
| - name: Build C# project | |
| run: | | |
| dotnet new console -o assignment_4/csharp --force | |
| dotnet build assignment_4/csharp -o assignment_4/output_csharp | |
| - name: Build Kotlin project | |
| run: | | |
| sudo apt update && sudo apt install -y kotlin zip | |
| mkdir -p assignment_4/output_kotlin | |
| kotlinc assignment_4/kotlin/*.kt -include-runtime -d assignment_4/output_kotlin/kotlin_program.jar | |
| - name: Zip built artifacts | |
| run: | | |
| mkdir -p assignment_4/output_final | |
| cp assignment_4/output_cpp/cpp_program assignment_4/output_final/ | |
| cp assignment_4/output_csharp/* assignment_4/output_final/ | |
| cp assignment_4/output_kotlin/kotlin_program.jar assignment_4/output_final/ | |
| zip -r assignment_4/release_artifacts.zip assignment_4/output_final | |
| - name: Upload as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release_artifacts | |
| path: assignment_4/release_artifacts.zip | |
| release: | |
| needs: build | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release_artifacts | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: assignment_4/release_artifacts.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |