-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 3.01 KB
/
on_push_pr_main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Push & PR to the main branch
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
detect_changes:
name: Detect repository changes
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'backend/**'
frontend:
- 'front/**'
lint_frontend:
name: Lint frontend
needs: detect_changes
if: ${{ needs.detect_changes.outputs.frontend == 'true' }}
uses: ./.github/workflows/flow_front_lint.yml
security_frontend:
name: Run Snyk on the frontend
runs-on: ubuntu-latest
needs: detect_changes
if: ${{ needs.detect_changes.outputs.frontend == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "./front"
- name: Install dependencies
run: npm ci
working-directory: "./front"
- name: Run Snyk
uses: snyk/actions/[email protected]
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=front/package.json --sarif-file-output=snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snyk.sarif
lint_backend:
name: Lint backend
needs: detect_changes
if: ${{ needs.detect_changes.outputs.backend == 'true' }}
uses: ./.github/workflows/flow_backend_lint.yml
security_backend:
name: Run Snyk on the backend
runs-on: ubuntu-latest
needs: detect_changes
if: ${{ needs.detect_changes.outputs.backend == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Run Snyk
uses: snyk/actions/[email protected]
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=backend/build.gradle.kts --all-sub-projects --sarif-file-output=snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snyk.sarif
build_push_backend:
name: Build & push Docker image of the "${{ matrix.service }}" service
needs: lint_backend
uses: ./.github/workflows/flow_backend_build_push.yml
secrets: inherit
strategy:
matrix:
service: [api_gateway, jobs, messaging, employer, notification, profile, recommendation]
with:
service-name: ${{ matrix.service }}
push-image: ${{ github.event_name != 'pull_request' }}
image-tags: |
type=sha
type=ref,event=branch
type=edge,branch=main