Skip to content

Commit 8b1288b

Browse files
committed
Edit Continuous Integration and Notification
1 parent f29f0b7 commit 8b1288b

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

.github/workflows/main.yaml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ on:
66
- main
77

88
jobs:
9-
build-deploy:
10-
name: Build and Deploy Comment Service
9+
testing:
10+
name: Testing Video Service
1111
runs-on: ubuntu-latest
1212
steps:
13+
1314
- name: Checkout code
1415
uses: actions/checkout@v3
1516

@@ -23,4 +24,28 @@ jobs:
2324
run: echo "SPRING_DATA_MONGODB_URI=mongodb://localhost:27017/video-service" >> $GITHUB_ENV
2425

2526
- name: Unit Tests
26-
run: mvn -B test --file pom.xml
27+
run: mvn -B test --file pom.xml
28+
29+
# - name: SonarQube Scan
30+
# env:
31+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32+
# run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar \
33+
# -Dsonar.projectKey=devops-video-sharing \
34+
# -Dsonar.host.url=https://sonarcloud.io \
35+
# -Dsonar.login=${{ secrets.SONAR_TOKEN }}
36+
37+
build-image:
38+
needs: testing
39+
uses: ./.github/workflows/build-image.yaml
40+
secrets:
41+
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
42+
43+
scan-image:
44+
needs: build-image
45+
uses: ./.github/workflows/scan-image.yaml
46+
47+
notify:
48+
needs: scan-image
49+
uses: ./.github/workflows/notifyCI.yaml
50+
secrets:
51+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/notifyCI.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Send Slack Notification for Video Service
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
SLACK_WEBHOOK_URL:
7+
required: true
8+
9+
jobs:
10+
success_notifier:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Send success notification on Slack
15+
uses: slackapi/[email protected]
16+
with:
17+
payload: |
18+
{
19+
"text": "The Continuous Integration for Video Service workflow has completed successfully."
20+
}
21+
env:
22+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
23+
24+
failure_notifier:
25+
if: ${{ github.event.workflow_run.conclusion != 'success' }}
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Send failure notification on Slack
29+
uses: slackapi/[email protected]
30+
with:
31+
payload: |
32+
{
33+
"text": "The Continuous Integration for Video Service workflow has failed."
34+
}
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)