Enhance repo and code organization #5
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: CI/CD | |
| on: | |
| push: | |
| branches: [ main, develop, 'claude/**' ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| dotnet-version: ['8.0.x'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet-version }} | |
| - name: Display .NET version | |
| run: dotnet --version | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Run tests | |
| run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: '**/coverage.cobertura.xml' | |
| fail_ci_if_error: false | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Format check | |
| run: dotnet format --verify-no-changes --verbosity diagnostic || true | |
| - name: Build for analysis | |
| run: dotnet build --configuration Release | |
| package: | |
| name: Package Application | |
| runs-on: ubuntu-latest | |
| needs: [build-and-test, code-quality] | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Publish Linux x64 | |
| run: dotnet publish src/TaskManager.CLI/TaskManager.CLI.csproj -c Release -r linux-x64 --self-contained -o ./publish/linux-x64 | |
| - name: Publish Windows x64 | |
| run: dotnet publish src/TaskManager.CLI/TaskManager.CLI.csproj -c Release -r win-x64 --self-contained -o ./publish/win-x64 | |
| - name: Publish macOS x64 | |
| run: dotnet publish src/TaskManager.CLI/TaskManager.CLI.csproj -c Release -r osx-x64 --self-contained -o ./publish/osx-x64 | |
| - name: Upload Linux artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: taskman-linux-x64 | |
| path: ./publish/linux-x64/ | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: taskman-win-x64 | |
| path: ./publish/win-x64/ | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: taskman-osx-x64 | |
| path: ./publish/osx-x64/ |