-
Notifications
You must be signed in to change notification settings - Fork 9
96 lines (87 loc) · 3.52 KB
/
Copy pathtest.yml
File metadata and controls
96 lines (87 loc) · 3.52 KB
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
---
name: _test
description: Test trigger workflow
on:
workflow_call:
inputs:
build_matrix:
required: true
type: string
description: Build matrix for the test job
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build_matrix: ${{ fromJson(inputs.build_matrix) }}
steps:
- name: Sync Codebase
id: sync
uses: Audioreach/meta-ar/.github/actions/sync@main
with:
event_name: ${{ github.event_name }}
pr_ref: ${{ github.event.pull_request.head.ref }}
pr_repo: ${{ github.event.pull_request.head.repo.full_name }}
base_ref: ${{ github.ref_name }}
- name: Process URLs
id: process_urls
uses: Audioreach/meta-ar/.github/actions/process_urls@main
env:
MACHINE: ${{ matrix.build_matrix.machine }}
- name: Print trigger
run: |
echo "Triggered by ${{ github.event_name }}"
echo "Build URL: ${{ steps.process_urls.outputs.flat_build_url }}"
echo "Build file name: ${{ steps.process_urls.outputs.filename }}"
- name: Modify test configurations
id: listjobs
run: |
kas_file="${{ matrix.build_matrix.kas_file }}"
DIR_NAME="${kas_file%.yml}"
target_file="ci/lava/${DIR_NAME}/boot.yaml"
if [ ! -f "$target_file" ]; then
echo "Target file $target_file does not exist."
echo "target_file=" >> $GITHUB_OUTPUT
exit 0
fi
TARGET=${target_file}
FIND_PATH="${TARGET#*/}"
DEVICE_TYPE_PATH="${FIND_PATH%/*}"
DEVICE_TYPE="${DEVICE_TYPE_PATH#*/}"
GITHUB_SHA="${{ github.sha }}"
GITHUB_RUN_ID="${{ github.run_id }}"
BUILD_FILE_NAME="${{ steps.process_urls.outputs.filename }}"
BUILD_DOWNLOAD_URL="${{ steps.process_urls.outputs.flat_build_url }}"
sed -i "s|{{DEVICE_TYPE}}|${DEVICE_TYPE}|g" "${target_file}"
sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" "${target_file}"
ESCAPED_URL=$(echo "$BUILD_DOWNLOAD_URL" | sed 's/[&/?=]/\\&/g')
sed -i "s|{{BUILD_DOWNLOAD_URL}}|$ESCAPED_URL|g" "${target_file}"
sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" "${target_file}"
sed -i "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" "${target_file}"
cat "${target_file}"
echo "target_file=${target_file}" >> $GITHUB_OUTPUT
# Submit job to LAVA
- name: Test ${{ matrix.build_matrix.machine }}
if: ${{ steps.listjobs.outputs.target_file != '' }}
id: submit_job
timeout-minutes: 20
uses: foundriesio/lava-action@v6
with:
lava_token: ${{ secrets.LAVATOKEN }}
lava_url: 'lava.infra.foundries.io'
job_definition: ${{ steps.listjobs.outputs.target_file }}
wait_for_job: true
fail_action_on_failure: true
save_result_as_artifact: true
save_job_details: true
- name: Update Summary
if: success() || failure()
run: |
if [ "${{ steps.submit_job.outcome }}" == "success" ]; then
echo "## Test Job Summary" >> $GITHUB_STEP_SUMMARY
echo ":heavy_check_mark: Test job for ${{ matrix.build_matrix.machine }} completed successfully." >> $GITHUB_STEP_SUMMARY
else
echo "## Test Job Summary" >> $GITHUB_STEP_SUMMARY
echo ":x: Test job for ${{ matrix.build_matrix.machine }} failed." >> $GITHUB_STEP_SUMMARY
fi