Skip to content

Commit

Permalink
ci: Build ROM release from versioned git ref
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Doron <[email protected]>
  • Loading branch information
benjamindoron committed Aug 12, 2024
1 parent eb80750 commit 76849ce
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/fpga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
hw-version:
default: "latest"
type: string
rom-ref:
default: "main"
type: string
workflow_call:
description: 'Set true for workflow_call'
default: true
Expand Down Expand Up @@ -111,6 +114,13 @@ jobs:
with:
submodules: 'true'

- name: Checkout versioned ROM (${{ inputs.rom-ref }})
- uses: actions/checkout@v3
with:
ref: ${{ inputs.rom-ref }}
sparse-checkout: |
rom
- name: Restore sysroot from cache
uses: actions/cache/restore@v3
id: restore_sysroot_cache
Expand Down Expand Up @@ -347,6 +357,13 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Checkout versioned ROM (${{ inputs.rom-ref }})
- uses: actions/checkout@v3
with:
ref: ${{ inputs.rom-ref }}
sparse-checkout: |
rom
- name: Pull dpe submodule
run: |
git submodule update --init dpe
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/fw-test-emu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
extra-features:
default:
type: string
rom-ref:
default: "main"
type: string
rom-logging:
default: true
type: boolean
Expand Down Expand Up @@ -45,6 +48,13 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Checkout versioned ROM (${{ inputs.rom-ref }})
- uses: actions/checkout@v3
with:
ref: ${{ inputs.rom-ref }}
sparse-checkout: |
rom
- name: Pull dpe submodule
run: |
git submodule update --init dpe
Expand Down
168 changes: 168 additions & 0 deletions .github/workflows/versioned-full-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Versioned Build Test

on:
workflow_dispatch:
inputs:
hw-version:
default: "latest"
type: string
rom-ref:
default: "main"
type: string
firmware-version:
default: "main"
type: string

jobs:
fpga-full-suite-etrng-log:
name: FPGA Suite (etrng, log)
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-${{ inputs.hw-version }}-etrng-log
extra-features: slow_tests
hw-version: "${{ inputs.hw-version }}"
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: true
fpga-itrng: false

fpga-full-suite-etrng-nolog:
name: FPGA Suite (etrng, nolog)
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-${{ inputs.hw-version }}-etrng-nolog
extra-features: slow_tests
hw-version: "${{ inputs.hw-version }}"
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: false
fpga-itrng: false

fpga-full-suite-itrng-log:
name: FPGA Suite (itrng, log)
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-${{ inputs.hw-version }}-itrng-log
extra-features: slow_tests,itrng
hw-version: "${{ inputs.hw-version }}"
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: true
fpga-itrng: true

fpga-full-suite-itrng-nolog:
name: FPGA Suite (itrng, nolog)
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-${{ inputs.hw-version }}-itrng-nolog
extra-features: slow_tests,itrng
hw-version: "${{ inputs.hw-version }}"
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: false
fpga-itrng: true

sw-emulator-full-suite-etrng-log:
name: sw-emulator Suite (etrng, log)
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-${{ inputs.hw-version }}-etrng-log
extra-features: slow_tests
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: true

sw-emulator-full-suite-etrng-nolog:
name: sw-emulator Suite (etrng, nolog)
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-${{ inputs.hw-version }}-etrng-nolog
extra-features: slow_tests
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: false

sw-emulator-full-suite-itrng-log:
name: sw-emulator Suite (itrng, log)
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-${{ inputs.hw-version }}-itrng-log
extra-features: slow_tests,itrng
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: true

sw-emulator-full-suite-itrng-nolog:
name: sw-emulator Suite (itrng, nolog)
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-${{ inputs.hw-version }}-itrng-nolog
extra-features: slow_tests,itrng
rom-ref: "${{ inputs.rom-ref }}"
rom-logging: false

create-release:
name: Create New Release
needs:
- fpga-full-suite-etrng-log
- fpga-full-suite-etrng-nolog
- fpga-full-suite-itrng-log
- fpga-full-suite-itrng-nolog
- sw-emulator-full-suite-etrng-log
- sw-emulator-full-suite-etrng-nolog
- sw-emulator-full-suite-itrng-log
- sw-emulator-full-suite-itrng-nolog

runs-on: ubuntu-22.04

permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
ref: ${{ inputs.firmware-version }}

- name: Checkout versioned ROM (${{ inputs.rom-ref }})
- uses: actions/checkout@v3
with:
ref: ${{ inputs.rom-ref }}
sparse-checkout: |
rom
# TODO: Continue from here
- name: Generate release zip
run: |
./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
- name: 'Download all artifacts'
uses: actions/download-artifact@v4
with:
path: /tmp/artifacts

- name: Package all test artifacts for release
run: |
(cd /tmp/artifacts && zip -r - .) > ./release/test_artifacts_${{ needs.find-latest-release.outputs.new_release_tag }}.zip
- name: Tag repo with new release number
run: |
git config --global user.name "GitHub CI"
git config --global user.email "[email protected]"
git tag ${{ needs.find-latest-release.outputs.new_release_tag }}
git push origin ${{ needs.find-latest-release.outputs.new_release_tag }}
- name: Upload release
uses: softprops/action-gh-release@v1
with:
files: |
./release/caliptra_${{ needs.find-latest-release.outputs.new_release_tag }}.zip
./release/test_artifacts_${{ needs.find-latest-release.outputs.new_release_tag }}.zip
tag_name: ${{ needs.find-latest-release.outputs.new_release_tag }}
prerelease: true

- name: Write artifact to workflow with release info
run: |
mkdir /tmp/release-info
echo "${{ needs.find-latest-release.outputs.new_release_tag }}" > /tmp/release-info/tag-name
echo "caliptra_${{ needs.find-latest-release.outputs.new_release_tag }}.zip" > /tmp/release-info/zip-file-name
- name: Write artifact with release info
uses: actions/upload-artifact@v4
with:
name: release-info
path: /tmp/release-info

0 comments on commit 76849ce

Please sign in to comment.