-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/27 implement cicd #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c28b248
50b4429
c0373ba
7ebee97
bf42032
bed1cf3
98f583d
6135ac9
7b04e94
e59649b
d488a57
d074297
d51e4b0
54246bc
18fb0d1
19c2cc6
a21325a
2f57ded
763f9e2
7108a1c
4731e4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| **/.dockerignore | ||
| **/.env | ||
| **/.git | ||
| **/.gitignore | ||
| **/.vs | ||
| **/.vscode | ||
| **/bin | ||
| **/obj | ||
| **/Dockerfile | ||
| **/node_modules | ||
| **/dist | ||
| **/.angular |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| * text=auto | ||
| *.sh text eol=lf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: PR Validation | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
| - main | ||
|
|
||
| jobs: | ||
| build-and-test-api: | ||
| name: API Validation | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
|
|
||
| - name: Restore dependencies | ||
| run: dotnet restore -p:Configuration=Release | ||
|
|
||
| - name: Build project | ||
| run: dotnet build --no-restore --configuration Release | ||
|
|
||
| - name: Run Unit & Integration Tests | ||
| run: dotnet test --no-build --configuration Release --verbosity normal | ||
|
|
||
| - name: Verify API Dockerfile builds | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: src/api/SmartEventBooking.Web/Dockerfile | ||
| push: false | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
|
|
||
| build-and-test-client: | ||
| name: Client UI Validation | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./src/client | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: src/client/.nvmrc | ||
| cache: 'npm' | ||
| cache-dependency-path: ./src/client/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run client tests | ||
| run: npm test -- --watch=false | ||
|
|
||
| - name: Verify Client Dockerfile builds | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./src/client | ||
| push: false | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The release-to-prod.yml workflow builds and deploys immediately upon a push to main. It does not run any unit or integration tests. If a merge to main introduces an integration issue not caught in the PR, it will be deployed directly to production.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: Release to Production | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| env: | ||
| API_IMAGE: smart-event-booking-api-app | ||
| CLIENT_IMAGE: smart-event-booking-client-app | ||
| AZURE_WEBAPP_API_NAME: app-smarteventbooking-api | ||
| AZURE_WEBAPP_CLIENT_NAME: app-smarteventbooking-client | ||
|
|
||
| jobs: | ||
| run-tests: | ||
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
|
|
||
| - name: Run API tests | ||
| run: dotnet test --configuration Release --verbosity normal | ||
|
|
||
| build-and-push: | ||
| needs: run-tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} | ||
|
|
||
| - name: Build and push API | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: src/api/SmartEventBooking.Web/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:latest | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push Client | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./src/client | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:latest | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| deploy-api: | ||
| needs: build-and-push | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy API to Azure Web App | ||
| uses: azure/webapps-deploy@v2 | ||
| with: | ||
| app-name: ${{ env.AZURE_WEBAPP_API_NAME }} | ||
| publish-profile: ${{ secrets.AZURE_API_PUBLISH_PROFILE }} | ||
| images: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.API_IMAGE }}:${{ github.sha }}' | ||
|
|
||
| - name: Smoke test API | ||
| run: | | ||
| curl --retry 10 --retry-delay 10 --retry-connrefused --fail \ | ||
| ${{ vars.AZURE_WEBAPP_API_URL }}/health/db | ||
|
|
||
| deploy-client: | ||
| needs: build-and-push | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy Client to Azure Web App | ||
| uses: azure/webapps-deploy@v2 | ||
| with: | ||
| app-name: ${{ env.AZURE_WEBAPP_CLIENT_NAME }} | ||
| publish-profile: ${{ secrets.AZURE_CLIENT_PUBLISH_PROFILE }} | ||
| images: '${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CLIENT_IMAGE }}:${{ github.sha }}' | ||
|
|
||
| - name: Smoke test Client | ||
| run: | | ||
| curl --retry 10 --retry-delay 10 --retry-connrefused --fail \ | ||
| ${{ vars.AZURE_WEBAPP_CLIENT_URL }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -417,5 +417,5 @@ FodyWeavers.xsd | |
| *.msm | ||
| *.msp | ||
|
|
||
| docker-compose.yml | ||
| Dockerfile | ||
| #docker-compose.yml | ||
| #Dockerfile | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Client-Side Tests: In pr-validation.yml, the
build-and-test-clientjob installs dependencies and builds the project, but it never runs npm test. Regressions in UI logic will not be caught during PR reviews.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done