Skip to content

Commit d5fd004

Browse files
authored
file download and check
1 parent df9e815 commit d5fd004

1 file changed

Lines changed: 45 additions & 7 deletions

File tree

.github/workflows/unit.tests.yml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ on:
66
pull_request:
77
branches: [ "develop" ]
88
types: [opened, synchronize, reopened, auto_merge_enabled]
9-
workflow_dispatch:
9+
workflow_dispatch:
10+
inputs:
11+
file_url:
12+
description: 'URL of the file to download and verify'
13+
required: true
14+
type: string
15+
download_path:
16+
description: 'Local path/filename to save the downloaded file'
17+
required: false
18+
default: 'downloaded_file'
19+
type: string
20+
1021
permissions:
1122
pull-requests: read
1223

@@ -18,16 +29,16 @@ jobs:
1829
java-version: [17]
1930
steps:
2031
- name: Checkout repository
21-
uses: actions/checkout@v6
22-
32+
uses: actions/checkout@v4
33+
2334
- name: Set up JDK ${{ matrix.java-version }}
2435
uses: actions/setup-java@v4
2536
with:
2637
distribution: 'temurin'
2738
java-version: ${{ matrix.java-version }}
28-
39+
2940
- name: Cache Maven dependencies
30-
uses: actions/cache@v5
41+
uses: actions/cache@v4
3142
with:
3243
path: ~/.m2
3344
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -36,10 +47,37 @@ jobs:
3647
3748
- name: Install dependencies and run tests with coverage
3849
run: |
39-
mvn clean install -P unit-tests -DskipIntegrationTests
50+
mvn clean install -P unit-tests -DskipIntegrationTests
4051
4152
- name: Upload code coverage report
42-
uses: actions/upload-artifact@v6
53+
uses: actions/upload-artifact@v4
4354
with:
4455
name: code-coverage-report
4556
path: target/site/jacoco/jacoco.xml
57+
58+
# ── File download + verification (only on workflow_dispatch) ──────────────
59+
- name: Download file from URL
60+
if: github.event_name == 'workflow_dispatch'
61+
run: |
62+
curl -fSL \
63+
"${{ github.event.inputs.file_url }}" \
64+
-o "${{ github.event.inputs.download_path }}"
65+
66+
- name: Wait 30 seconds
67+
if: github.event_name == 'workflow_dispatch'
68+
run: sleep 30
69+
70+
- name: Verify downloaded file
71+
if: github.event_name == 'workflow_dispatch'
72+
run: |
73+
FILE="${{ github.event.inputs.download_path }}"
74+
if [ -f "$FILE" ]; then
75+
FILE_NAME=$(basename "$FILE")
76+
FILE_SIZE=$(stat -c '%s' "$FILE")
77+
echo "✅ File exists"
78+
echo " Name : $FILE_NAME"
79+
echo " Size : $FILE_SIZE bytes"
80+
else
81+
echo "❌ File NOT found at path: $FILE"
82+
exit 1
83+
fi

0 commit comments

Comments
 (0)