fix: resolve CI/CD pipeline issues #3
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 Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| version-check: | |
| name: Version Consistency Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd client-ts | |
| npm ci | |
| - name: Check version consistency | |
| run: | | |
| node scripts/check-version.js check | |
| frontend-tests: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd client-ts | |
| npm ci | |
| - name: Run linting | |
| run: | | |
| cd client-ts | |
| npm run lint | |
| - name: Run type checking | |
| run: | | |
| cd client-ts | |
| npm run type-check | |
| - name: Run tests | |
| run: | | |
| cd client-ts | |
| npm run test:ci | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: client-ts/coverage/lcov.info | |
| flags: frontend | |
| backend-tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build application | |
| 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@v3 | |
| with: | |
| file: '**/coverage.cobertura.xml' | |
| flags: backend | |
| build: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: [version-check, frontend-tests, backend-tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Install frontend dependencies | |
| run: | | |
| cd client-ts | |
| npm ci | |
| - name: Build frontend | |
| run: | | |
| cd client-ts | |
| npm run build | |
| - name: Restore backend dependencies | |
| run: dotnet restore | |
| - name: Build backend | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Publish backend | |
| run: dotnet publish --configuration Release --no-build --output ./publish | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| publish/ | |
| client-ts/build/ | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() && success() | |
| with: | |
| sarif_file: 'trivy-results.sarif' | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Get version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Install dependencies | |
| run: | | |
| cd client-ts | |
| npm ci | |
| - name: Build and package release | |
| run: | | |
| node scripts/release.js --skip-git | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-artifacts | |
| path: releases/ | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| release_name: Release ${{ steps.version.outputs.VERSION }} | |
| body_path: releases/${{ steps.version.outputs.VERSION }}/RELEASE_NOTES.md | |
| draft: false | |
| prerelease: false | |
| - name: Upload release files | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: releases/TaskManagerApp-${{ steps.version.outputs.VERSION }}.tar.gz | |
| asset_name: TaskManagerApp-${{ steps.version.outputs.VERSION }}.tar.gz | |
| asset_content_type: application/gzip |