-
Notifications
You must be signed in to change notification settings - Fork 55
56 lines (50 loc) · 2.12 KB
/
qg-example.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
name: CI Tests
on:
workflow_dispatch:
env:
KOTLIN_VERSION: '1.4.32'
RP_INSTANCE: 'https://demo.reportportal.io'
SCRIPT_TIMEOUT_SECONDS: 60
REQUEST_TIMEOUT_SECONDS: 60
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Kotlin
run: |
kotlinc -version
rm -rf /usr/share/kotlinc
curl -L "https://github.com/JetBrains/kotlin/releases/download/v$KOTLIN_VERSION/kotlin-compiler-$KOTLIN_VERSION.zip" -o /tmp/kotlin-compiler.zip
unzip /tmp/kotlin-compiler.zip -d /usr/share
export PATH="$PATH:/opt/kotlinc/bin"
echo "$PATH"
kotlinc -version
- name: Test
continue-on-error: true
run: |
# Cast execution flag on gradle wrapper script file, just in case
chmod +x ./gradlew
./gradlew :service-api:demoSmoke -Prp.api.key=${{ secrets.RP_DEMO_KEY }} -Prp.admin.password=${{ secrets.RP_ADMIN_PASSWORD }} | tee ./console.log
sed -rn 's/ReportPortal Launch UUID: ([^\\r\\n]+)/LAUNCH_UUID=\1/ p' ./console.log >> "$GITHUB_ENV"
- name: Quality Gate
run: |
echo "Quality gate"
echo "LAUNCH_UUID: $LAUNCH_UUID"
QUALITY_GATE_STATUS=""
START_TIME=$(date +%s)
while [ -z "$QUALITY_GATE_STATUS" ] && [ $(( $(date +%s) - START_TIME )) -lt ${{ env.SCRIPT_TIMEOUT_SECONDS }} ]; do
echo "Waiting for quality gate status..."
sleep 10
QUALITY_GATE_JSON=$(curl -s -H "Authorization: Bearer $RP_DEMO_KEY" --max-time "${{ env.REQUEST_TIMEOUT_SECONDS }}" "${{ env.RP_INSTANCE }}/api/v1/report_portal_demo/launch/${LAUNCH_UUID}")
QUALITY_GATE_STATUS=$(echo "$QUALITY_GATE_JSON" | jq -r '.metadata.qualityGate.status // empty')
done
if [ "$QUALITY_GATE_STATUS" != "PASSED" ]; then
echo "Quality gate status: $QUALITY_GATE_STATUS"
echo "Failing the pipeline."
exit 1
else
echo "Quality gate status: $QUALITY_GATE_STATUS"
echo "Pipeline passed."
fi