-
Notifications
You must be signed in to change notification settings - Fork 63
ci: Build ROM release from versioned git ref (revive) #1907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a8417c5
6859a34
fa3643d
0fc9843
1e3600c
28e8444
992e601
a6befd0
bc244c7
e1b4d57
fde2582
e6c4b43
d848cf2
5a18c4c
95f5d63
04ab844
82d74f7
7a3fe84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,7 +4,6 @@ name: FPGA Build | |||||||||||||
on: | ||||||||||||||
push: | ||||||||||||||
branches: ["main"] | ||||||||||||||
pull_request: | ||||||||||||||
workflow_call: | ||||||||||||||
inputs: | ||||||||||||||
artifact-suffix: | ||||||||||||||
|
@@ -25,6 +24,12 @@ on: | |||||||||||||
rom-version: | ||||||||||||||
default: "latest" | ||||||||||||||
type: string | ||||||||||||||
rom-ref: | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think ultimately our goal is for the nightly release workflow to be runnable with specified ROM & FW refs. Would it make sense to try to factor out some of the steps in this file so it can be reused in the nightly one as well? Not sure if that would improve things or just make the CI more confusing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO only the nightly should do this, I think the load would be too high for PRs. |
||||||||||||||
default: "main" | ||||||||||||||
type: string | ||||||||||||||
fw-ref: | ||||||||||||||
default: "main" | ||||||||||||||
type: string | ||||||||||||||
workflow_call: | ||||||||||||||
description: 'Set true for workflow_call' | ||||||||||||||
default: true | ||||||||||||||
|
@@ -42,7 +47,6 @@ on: | |||||||||||||
default: '["caliptra-fpga"]' | ||||||||||||||
type: string | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
jobs: | ||||||||||||||
check_cache: | ||||||||||||||
runs-on: ubuntu-22.04 | ||||||||||||||
|
@@ -106,9 +110,21 @@ jobs: | |||||||||||||
path: /tmp/caliptra-fpga-kmod/ | ||||||||||||||
retention-days: 1 | ||||||||||||||
|
||||||||||||||
# this workflow uploads a file named caliptra-unified-<rom-ref>-<fw-ref>-<hw-version>-<artifact-suffix> | ||||||||||||||
versioned-checkout-build: | ||||||||||||||
uses: ./.github/workflows/versioned-checkout.yml | ||||||||||||||
with: | ||||||||||||||
rom-ref: "${{ inputs.rom-ref }}" | ||||||||||||||
rom-logging: "${{ inputs.rom-logging }}" | ||||||||||||||
fw-ref: "${{ inputs.fw-ref }}" | ||||||||||||||
hw-version: "${{ inputs.hw-version }}" | ||||||||||||||
workflow_call: "${{ inputs.workflow_call }}" | ||||||||||||||
artifact-suffix: "${{ inputs.artifact-suffix }}" | ||||||||||||||
Comment on lines
+113
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to isolate the FPGA jobs to the nightly run? I think running all of these tests on each PR will effectively DDOS the FPGA infra. |
||||||||||||||
|
||||||||||||||
build_test_binaries: | ||||||||||||||
runs-on: [e2-standard-8] | ||||||||||||||
timeout-minutes: 60 | ||||||||||||||
needs: versioned-checkout-build | ||||||||||||||
|
||||||||||||||
env: | ||||||||||||||
# Change this to a new random value if you suspect the cache is corrupted | ||||||||||||||
|
@@ -127,6 +143,12 @@ jobs: | |||||||||||||
path: /tmp/caliptra-fpga-sysroot.tar | ||||||||||||||
key: sysroot-v9-${{ env.CACHE_BUSTER }} | ||||||||||||||
|
||||||||||||||
- name: Extract Versioned ROM and FMC/RT | ||||||||||||||
uses: actions/download-artifact@v4 | ||||||||||||||
with: | ||||||||||||||
# defined in versioned-checkout.yml, files will be moved to /tmp/caliptra | ||||||||||||||
name: caliptra-unified-${{ inputs.rom-ref }}-${{ inputs.fw-ref }}-${{ inputs.hw-version }}-${{ inputs.artifact-suffix }} | ||||||||||||||
|
||||||||||||||
- name: Extract sysroot | ||||||||||||||
if: "steps.restore_sysroot_cache.outputs.cache-hit" | ||||||||||||||
run: | | ||||||||||||||
|
@@ -137,7 +159,7 @@ jobs: | |||||||||||||
run: | | ||||||||||||||
sudo apt-get update -qy && sudo apt-get -y install debootstrap binfmt-support qemu-user-static u-boot-tools | ||||||||||||||
|
||||||||||||||
- name: build sysroot | ||||||||||||||
- name: Build sysroot | ||||||||||||||
# Note: This is the sysroot for the tiny debian installation we run on the FPGA; | ||||||||||||||
# it is missing xilinx-provided kernel headers needed to build kernel modules | ||||||||||||||
if: "!steps.restore_sysroot_cache.outputs.cache-hit" | ||||||||||||||
|
@@ -146,7 +168,7 @@ jobs: | |||||||||||||
sudo debootstrap --include linux-libc-dev --arch arm64 --foreign bookworm /tmp/caliptra-fpga-sysroot | ||||||||||||||
sudo chroot /tmp/caliptra-fpga-sysroot /debootstrap/debootstrap --second-stage | ||||||||||||||
|
||||||||||||||
# Remove unnecesary files | ||||||||||||||
# Remove unnecessary files | ||||||||||||||
sudo find /tmp/caliptra-fpga-sysroot/ \( -type d -and ! -perm -o=r \) -prune -exec rm -rf {} \; | ||||||||||||||
sudo find /tmp/caliptra-fpga-sysroot/ \( -type d -and ! -perm -o=x \) -prune -exec rm -rf {} \; | ||||||||||||||
sudo find /tmp/caliptra-fpga-sysroot/ \( ! -perm -o=r \) -exec rm -f {} \; | ||||||||||||||
|
@@ -179,9 +201,10 @@ jobs: | |||||||||||||
else | ||||||||||||||
FEATURES=fpga_realtime,itrng | ||||||||||||||
fi | ||||||||||||||
if [[ "${{ inputs.workflow_call }}" && "${{ inputs.hw-version }}" != "latest" ]]; then | ||||||||||||||
if [[ "${{ inputs.workflow_call }}" && -n "${{ inputs.hw-version }}" && "${{ inputs.hw-version }}" != "latest" ]]; then | ||||||||||||||
FEATURES=$FEATURES,hw-${{ inputs.hw-version }} | ||||||||||||||
fi | ||||||||||||||
|
||||||||||||||
cargo nextest archive \ | ||||||||||||||
--features=${FEATURES} \ | ||||||||||||||
--release \ | ||||||||||||||
|
@@ -199,22 +222,13 @@ jobs: | |||||||||||||
path: /tmp/caliptra-test-binaries.sqsh | ||||||||||||||
retention-days: 1 | ||||||||||||||
|
||||||||||||||
- name: Build test firmware | ||||||||||||||
run: | | ||||||||||||||
mkdir /tmp/caliptra-test-firmware | ||||||||||||||
|
||||||||||||||
FEATURES="" | ||||||||||||||
if [[ "${{ inputs.workflow_call }}" && "${{ inputs.hw-version }}" != "latest" ]]; then | ||||||||||||||
FEATURES=hw-${{ inputs.hw-version }} | ||||||||||||||
fi | ||||||||||||||
cargo run --release -p caliptra-builder --features=${FEATURES} -- --all_elfs /tmp/caliptra-test-firmware | ||||||||||||||
|
||||||||||||||
- name: 'Upload test firmware artifact' | ||||||||||||||
uses: actions/upload-artifact@v4 | ||||||||||||||
with: | ||||||||||||||
name: caliptra-test-firmware${{ inputs.artifact-suffix }} | ||||||||||||||
path: /tmp/caliptra-test-firmware | ||||||||||||||
retention-days: 1 | ||||||||||||||
# This is replaced by claiptra-unified-${{ inputs.rom-ref }}-${{ inputs.fw-ref }}-${{ inputs.hw-version }}-${{ inputs.artifact-suffix }} | ||||||||||||||
# - name: 'Upload test firmware artifact' | ||||||||||||||
# uses: actions/upload-artifact@v4 | ||||||||||||||
# with: | ||||||||||||||
# name: caliptra-test-firmware${{ inputs.artifact-suffix }} | ||||||||||||||
# path: /tmp/caliptra-test-firmware | ||||||||||||||
# retention-days: 1 | ||||||||||||||
|
||||||||||||||
build_kernel_modules: | ||||||||||||||
runs-on: ubuntu-22.04 | ||||||||||||||
|
@@ -290,6 +304,10 @@ jobs: | |||||||||||||
uses: actions/checkout@v3 | ||||||||||||||
with: | ||||||||||||||
submodules: 'true' | ||||||||||||||
|
||||||||||||||
- name: Pull dpe submodule | ||||||||||||||
run: | | ||||||||||||||
git submodule update --init dpe | ||||||||||||||
Comment on lines
306
to
+310
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Looks like a few places could use this pattern to remove a step. |
||||||||||||||
|
||||||||||||||
- name: Mount FPGA tools | ||||||||||||||
run: | | ||||||||||||||
|
@@ -302,14 +320,14 @@ jobs: | |||||||||||||
cd hw/fpga | ||||||||||||||
mkdir caliptra_build | ||||||||||||||
if [ "${{ inputs.fpga-itrng }}" == "false" ]; then | ||||||||||||||
ITRNG=FALSE | ||||||||||||||
export ITRNG=FALSE | ||||||||||||||
else | ||||||||||||||
ITRNG=TRUE | ||||||||||||||
export ITRNG=TRUE | ||||||||||||||
fi | ||||||||||||||
if [ "${{ inputs.workflow_call }}" ]; then | ||||||||||||||
RTL_VERSION="${{ inputs.hw-version }}" | ||||||||||||||
export RTL_VERSION="${{ inputs.hw-version }}" | ||||||||||||||
else | ||||||||||||||
RTL_VERSION="latest" | ||||||||||||||
export RTL_VERSION="latest" | ||||||||||||||
fi | ||||||||||||||
/fpga-tools/Xilinx/Vivado/2022.2/bin/vivado -mode batch -source fpga_configuration.tcl -tclargs BUILD=TRUE ITRNG=${ITRNG} RTL_VERSION=${RTL_VERSION} | ||||||||||||||
if [ ! -f caliptra_build/caliptra_fpga.bin ]; then | ||||||||||||||
|
@@ -381,11 +399,11 @@ jobs: | |||||||||||||
name: caliptra-test-binaries${{ inputs.artifact-suffix }} | ||||||||||||||
path: /tmp/caliptra-test-binaries.sqsh | ||||||||||||||
|
||||||||||||||
- name: 'Download Test Firmware Artifact' | ||||||||||||||
uses: actions/download-artifact@v4 | ||||||||||||||
with: | ||||||||||||||
name: caliptra-test-firmware${{ inputs.artifact-suffix }} | ||||||||||||||
path: /tmp/caliptra-test-firmware | ||||||||||||||
# - name: 'Download Test Firmware Artifact' | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove commented code from PR |
||||||||||||||
# uses: actions/download-artifact@v4 | ||||||||||||||
# with: | ||||||||||||||
# name: caliptra-test-firmware${{ inputs.artifact-suffix }} | ||||||||||||||
# path: /tmp/caliptra-test-firmware | ||||||||||||||
|
||||||||||||||
- name: Mount binaries | ||||||||||||||
run: | | ||||||||||||||
|
@@ -425,12 +443,27 @@ jobs: | |||||||||||||
- name: Set clock rate | ||||||||||||||
run: | | ||||||||||||||
sudo bash -c 'echo 20000000 > /sys/bus/platform/drivers/xilinx_fclk/fclk0/set_rate' | ||||||||||||||
|
||||||||||||||
- name: Extract Versioned ROM and FMC/RT | ||||||||||||||
uses: actions/download-artifact@v4 | ||||||||||||||
with: | ||||||||||||||
# defined in versioned-checkout.yml, files will be moved to /tmp/caliptra | ||||||||||||||
name: caliptra-unified-${{ inputs.rom-ref }}-${{ inputs.fw-ref }}-${{ inputs.hw-version }}-${{ inputs.artifact-suffix }} | ||||||||||||||
path: /tmp/caliptra-unified | ||||||||||||||
|
||||||||||||||
- name: Debug List Downloads | ||||||||||||||
run: | | ||||||||||||||
ls -laR /tmp/caliptra-* | ||||||||||||||
|
||||||||||||||
- name: Execute tests | ||||||||||||||
run: | | ||||||||||||||
export RUST_TEST_THREADS=1 | ||||||||||||||
CALIPTRA_ARTIFACTS_PATH=caliptra-unified-${{ inputs.rom-ref }}-${{ inputs.fw-ref }}-${{ inputs.hw-version }}-${{ inputs.artifact-suffix }} | ||||||||||||||
TEST_BIN=/tmp/caliptra-test-binaries | ||||||||||||||
VARS="CPTRA_UIO_NUM=4 CALIPTRA_PREBUILT_FW_DIR=/tmp/caliptra-test-firmware CALIPTRA_IMAGE_NO_GIT_REVISION=1" | ||||||||||||||
VARS="CPTRA_UIO_NUM=4 " | ||||||||||||||
VARS+="CALIPTRA_PREBUILT_FW_DIR=/tmp/caliptra-unified/ " | ||||||||||||||
VARS+="CALIPTRA_PREBUILT_ROM_BIN=/tmp/caliptra-unified/caliptra-rom.bin " | ||||||||||||||
VARS+="CALIPTRA_IMAGE_NO_GIT_REVISION=1 " | ||||||||||||||
|
||||||||||||||
if [ "${{ inputs.rom-logging }}" == "true" ] || [ -z "${{ inputs.rom-logging }}" ]; then | ||||||||||||||
VARS+=" CPTRA_ROM_TYPE=ROM_WITH_UART" | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,17 @@ name: Nightly Release | |
|
||
on: | ||
workflow_dispatch: | ||
inupts: | ||
hw-version: | ||
default: "latest" | ||
type: string | ||
rom-ref: | ||
default: "main" | ||
type: string | ||
firmware-version: | ||
default: "main" | ||
type: string | ||
|
||
schedule: | ||
# 2:11 AM PST tuesday-saturday | ||
- cron: '11 10 * * 2-6' | ||
|
@@ -385,6 +396,9 @@ jobs: | |
|
||
- name: Generate release zip | ||
run: | | ||
# argc == 1: <release_name> | ||
# argc == 3: <release_name> <rom_ref> <firmware_ref> | ||
|
||
Comment on lines
+399
to
+401
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This comment is vague. Is it describing the args to |
||
./ci-tools/release/build_release.sh ${{ needs.find-latest-release.outputs.new_release_tag }} | ||
mv ./release/release.zip ./release/caliptra_${{ needs.find-latest-release.outputs.new_release_tag }}.zip | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Test Versioned Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
hw-version: | ||
default: "latest" | ||
type: string | ||
rom-ref: | ||
default: "main" | ||
type: string | ||
fw-ref: | ||
default: "main" | ||
type: string | ||
artifact-suffix: | ||
default: "test" | ||
type: string | ||
pull_request: | ||
inputs: | ||
hw-version: | ||
default: "latest" | ||
type: string | ||
rom-ref: | ||
default: "main" | ||
type: string | ||
fw-ref: | ||
default: "main" | ||
type: string | ||
artifact-suffix: | ||
default: "test" | ||
type: string | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-versioned-checkout: | ||
uses: ./.github/workflows/versioned-checkout.yml | ||
with: | ||
rom-ref: "main" | ||
rom-logging: false | ||
fw-ref: "main" | ||
hw-version: "latest" | ||
workflow_call: true | ||
artifact-suffix: "test" | ||
|
||
get-artifacts: | ||
runs-on: ubuntu-22.04 | ||
needs: test-versioned-checkout | ||
steps: | ||
- name: Download caliptra-unified artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: caliptra-unified-main-main-latest-test | ||
path: /tmp/caliptra-unified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the PR check for FPGAs, is this change intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this was not intentional, I will revert this change.