-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (112 loc) · 4.3 KB
/
validation-native.yaml
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
name: Quarkus Hilla Native Validation
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
pull_request_target:
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
concurrency:
group: validation-native-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
check-permissions:
name: Check User Permissions
runs-on: ubuntu-latest
steps:
- run: echo "Concurrency Group = ${{ github.head_ref || github.ref_name }}"
- uses: actions-cool/check-user-permission@main
id: checkUser
with:
username: ${{github.triggering_actor}}
require: 'write'
- name: Fail on workflow triggered by external contributor
if: ${{ steps.checkUser.outputs.require-result != 'true' && github.actor != 'dependabot[bot]' && github.actor != 'quarkus-hilla-bot[bot]' }}
run: |
echo "🚫 **${{ github.actor }}** is an external contributor, a **${{ github.repository }}** team member has to review this changes and re-run this build" \
| tee -a $GITHUB_STEP_SUMMARY && exit 1
changes:
name: Compute changes
needs: [check-permissions]
runs-on: ubuntu-latest
outputs:
validation-required: ${{ steps.filter.outputs.validate }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
validate:
- '!(README.md|LICENSE|.gitignore|etc/**)'
compute-matrix:
needs: [changes]
if: ${{ needs.changes.outputs.validation-required == 'true' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Compute matrix
id: compute-matrix
run: |
test_modules=$(find integration-tests -maxdepth 1 -mindepth 1 -type d -name "*-tests")
test_modules=$(while IFS= read -r mod; do grep -q "%test-security." $mod/src/main/resources/application.properties; echo "{\"path\": \"$mod\", \"security\": $? }"; done <<< "${test_modules}" | jq -s -c '.')
echo "modules=${test_modules}" >> "$GITHUB_OUTPUT"
build-and-test-native:
name: Native tests
needs: [compute-matrix]
if: ${{ needs.changes.outputs.validation-required == 'true' }}
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.compute-matrix.outputs.modules)}}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 23
distribution: 'graalvm'
cache: maven
- uses: browser-actions/setup-chrome@latest
id: setup-chrome
if: ${{ !vars.QH_DISABLE_CHROME_INSTALL }}
with:
chrome-version: stable
- name: Build
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp -DskipTests -Dmaven.javadoc.skip=false install
- name: Native Test
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp verify -am -DtrimStackTrace=false -Dselenide.browserBinary=${{ steps.setup-chrome.outputs.chrome-path }} -Pit-tests,production -Dnative -pl ${{ matrix.module.path }}
- name: Native Security Test
if: ${{ matrix.module.security == 1 }}
run: |
set -x -e -o pipefail
mvn -V -e -B -ntp verify -am -DtrimStackTrace=false -Dselenide.browserBinary=${{ steps.setup-chrome.outputs.chrome-path }} -Pit-tests,production -Dnative -Dquarkus.profile=test-security -pl ${{ matrix.module.path }}
- name: Package test output files
if: ${{ failure() || success() }}
run: find . -name surefire-reports -o -name failsafe-reports -o -name selenide-reports -o -name quarkus.log | tar -czf tests-report-native.tgz -T -
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: tests-output-it-native-${{ matrix.module }}
path: tests-report-*.tgz