This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
194 lines (194 loc) · 6.46 KB
/
checks.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Checks
on:
push:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
branches:
- '[0-9]+.[0-9]+.x'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
is_default_branch: ${{ steps['info']['outputs']['is-default-branch'] }}
is_release_branch: ${{ steps['info']['outputs']['is-release-branch'] }}
steps:
- name: Fetch repository information
id: info
run: |
DEFAULT_BRANCH=$(curl -s https://api.github.com/repos/syndesisio/syndesis |jq -r .default_branch)
IS_DEFAULT_BRANCH=$(test "refs/heads/${DEFAULT_BRANCH}" == "${GITHUB_REF}" && echo true || echo false)
IS_RELEASE_BRANCH=$(echo "${GITHUB_REF}" | grep -q -e '^refs/heads/[0-9]\+\.[0-9]\+\.x' && echo true || echo false)
echo "is-default-branch=${IS_DEFAULT_BRANCH}" >> $GITHUB_OUTPUT
echo "is-release-branch=${IS_RELEASE_BRANCH}" >> $GITHUB_OUTPUT
changes:
needs: setup
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
operator: ${{ steps.filter.outputs.operator }}
ui: ${{ steps.filter.outputs.ui }}
steps:
- uses: actions/checkout@v2
if: needs.setup.outputs.is_release_branch == 'true'
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
backend:
- 'app/(!(ui-react))**'
operator:
- 'install/operator/**'
ui:
- 'app/ui-react/**'
backend:
needs:
- changes
- setup
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: |
~/.m2/repository
!~/.m2/repository/io/syndesis
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
config-file: ./.github/codeql/codeql-config.yml
languages: java
- name: Build and test
run: tools/bin/syndesis build --batch-mode --backend
- name: Archive logs and test results
uses: actions/upload-artifact@v2
with:
name: checks-backend
path: |
app/**/target/*.log
app/**/target/surefire-reports/*
app/**/target/failsafe-reports/*
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Set up JDK 11
if: needs.setup.outputs.is_default_branch == 'true'
uses: actions/setup-java@v1
with:
java-version: 11
- name: Publish Sonar analysis
if: needs.setup.outputs.is_default_branch == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cd app
./mvnw -q -B -pl '!:extension-bom,!:integration-bom' jacoco:report \
&& ./mvnw -B -N -Dsonar.login=${{secrets.SONAR_TOKEN}} sonar:sonar -Dsonar.sources=$(find . -wholename "*/src/main/java" | sed -z 's/\n/,/g;s/,$/\n/') -Dsonar.java.binaries=$(find . -wholename "*/target/classes" | sed -z 's/\n/,/g;s/,$/\n/')
operator:
needs: changes
if: needs.changes.outputs.operator == 'true'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
config-file: ./.github/codeql/codeql-config.yml
languages: go
- name: Setup Go 1.16
uses: actions/setup-go@v2
with:
go-version: '1.16'
- name: Build and test
run: tools/bin/syndesis build --batch-mode -m operator --local
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
ui:
needs: changes
if: needs.changes.outputs.ui == 'true'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: |
~/.m2/repository
!~/.m2/repository/io/syndesis
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
config-file: ./.github/codeql/codeql-config.yml
languages: javascript
- name: Build and test
run: tools/bin/syndesis build --batch-mode -m ui-react
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
integration-tests:
needs: changes
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: |
~/.m2/repository
!~/.m2/repository/io/syndesis
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Build
run: tools/bin/syndesis build --backend --flash --batch-mode
- name: Build S2I image
run: tools/bin/syndesis build -m s2i --flash --docker
- name: Run integration tests
run: tools/bin/syndesis integration-test --s2i --logging
- name: Archive logs and test results
if: always()
uses: actions/upload-artifact@v2
with:
name: checks-integration-tests
path: |
app/test/integration-test/target/*.log
app/test/integration-test/target/citrus-reports/**/*
app/test/integration-test/target/failsafe-reports/*
app/s2i/target/invoker-reports/*
app/s2i/target/it/project/build.log