-
Notifications
You must be signed in to change notification settings - Fork 785
103 lines (95 loc) · 3.71 KB
/
fpga.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
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
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: FPGA test
on:
workflow_call:
inputs:
job_name:
required: true
type: string
description: Name of the job
bitstream:
required: true
type: string
description: Bitstream to use
board:
required: true
type: string
description: FPGA board to use
interface:
required: true
type: string
description: opentitantool interface to use
tag_filters:
required: true
type: string
description: Bazel tag filters for the tests
timeout:
default: 60
type: number
description: Timeout for the job in minutes
vivado_version:
default: "2021.1"
type: string
jobs:
fpga:
name: FPGA test
runs-on: [ubuntu-22.04-fpga, "${{ inputs.board }}"]
timeout-minutes: ${{ inputs.timeout }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare environment
uses: ./.github/actions/prepare-env
with:
service_account_json: '${{ secrets.BAZEL_CACHE_CREDS }}'
- name: Download bitstream
uses: ./.github/actions/download-partial-build-bin
with:
job-patterns: ${{ inputs.bitstream }}
# We run the update command twice to workaround an issue with udev on the container,
# where rusb cannot dynamically update its device list in CI (udev is not completely
# functional). If the device is in normal mode, the first thing that opentitantool
# does is to switch it to DFU mode and wait until it reconnects. This reconnection is
# never detected. But if we run the tool another time, the device list is queried again
# and opentitantool can finish the update. The device will now reboot in normal mode
# and work for the hyperdebug job.
- name: Update hyperdebug firmware
if: inputs.interface == 'hyper310'
run: |
./bazelisk.sh run \
//sw/host/opentitantool:opentitantool -- \
--interface=hyperdebug_dfu transport update-firmware \
|| ./bazelisk.sh run \
//sw/host/opentitantool:opentitantool -- \
--interface=hyperdebug_dfu transport update-firmware || true
- name: Execute tests
run: |
. util/build_consts.sh
module load "xilinx/vivado/${{ inputs.vivado_version }}"
# Execute a query to find all targets that match the test tags and store them in a file.
ci/scripts/run-bazel-test-query.sh \
target_pattern_file.txt \
"${{ inputs.tag_filters }}",-manual,-broken,-skip_in_ci \
//... @manufacturer_test_hooks//...
# Run FPGA tests
if [[ -s target_pattern_file.txt ]]; then
ci/scripts/run-fpga-tests.sh "${{ inputs.interface }}" target_pattern_file.txt || {
res=$?; echo "To reproduce failures locally, follow the instructions at https://opentitan.org/book/doc/getting_started/setup_fpga.html#reproducing-fpga-ci-failures-locally"; exit "${res}";
}
else
echo "No tests to run after filtering"
fi
- name: Publish Bazel test results
uses: ./.github/actions/publish-bazel-test-results
if: ${{ !cancelled() }}
with:
artifact-name: ${{ inputs.job_name }}-test-results
- name: Upload target pattern file
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.job_name }}-targets
path: target_pattern_file.txt