|
1 | 1 | name: UnitTestsWithCodeCoverageTestAK |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [ "develop" ] |
6 | | - pull_request: |
7 | | - branches: [ "develop" ] |
8 | | - types: [opened, synchronize, reopened, auto_merge_enabled] |
9 | 4 | workflow_dispatch: |
10 | 5 | inputs: |
11 | 6 | file_url: |
|
19 | 14 | default: 'eicar.com.txt' |
20 | 15 | type: string |
21 | 16 |
|
22 | | -permissions: |
23 | | - pull-requests: read |
24 | | - |
25 | 17 | jobs: |
26 | | - unitTests: |
| 18 | + download-and-verify: |
27 | 19 | runs-on: ubuntu-latest |
28 | | - strategy: |
29 | | - matrix: |
30 | | - java-version: [17] |
31 | 20 | steps: |
32 | | - - name: Checkout repository |
33 | | - uses: actions/checkout@v4 |
34 | | - |
35 | | - - name: Set up JDK ${{ matrix.java-version }} |
36 | | - uses: actions/setup-java@v4 |
37 | | - with: |
38 | | - distribution: 'temurin' |
39 | | - java-version: ${{ matrix.java-version }} |
40 | | - |
41 | | - - name: Cache Maven dependencies |
42 | | - uses: actions/cache@v4 |
43 | | - with: |
44 | | - path: ~/.m2 |
45 | | - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
46 | | - restore-keys: | |
47 | | - ${{ runner.os }}-maven- |
48 | | -
|
49 | | - - name: Install dependencies and run tests with coverage |
50 | | - run: | |
51 | | - mvn clean install -P unit-tests -DskipIntegrationTests |
52 | | -
|
53 | | - - name: Upload code coverage report |
54 | | - uses: actions/upload-artifact@v4 |
55 | | - with: |
56 | | - name: code-coverage-report |
57 | | - path: target/site/jacoco/jacoco.xml |
58 | | - |
59 | | - # ── File download + verification (only on workflow_dispatch) ────────────── |
60 | 21 | - name: Download file from URL |
61 | | - if: github.event_name == 'workflow_dispatch' |
62 | 22 | run: | |
63 | 23 | curl -fSL \ |
64 | 24 | "${{ github.event.inputs.file_url }}" \ |
65 | 25 | -o "${{ github.event.inputs.download_path }}" |
66 | 26 |
|
67 | 27 | - name: Wait 30 seconds |
68 | | - if: github.event_name == 'workflow_dispatch' |
69 | 28 | run: sleep 30 |
70 | 29 |
|
71 | 30 | - name: Verify downloaded file |
72 | | - if: github.event_name == 'workflow_dispatch' |
73 | 31 | run: | |
74 | 32 | FILE="${{ github.event.inputs.download_path }}" |
75 | 33 | if [ -f "$FILE" ]; then |
|
0 commit comments