From 76849ce20c33dd559b4526199c7645f04596903a Mon Sep 17 00:00:00 2001 From: Benjamin Doron Date: Thu, 4 Jul 2024 13:19:19 -0400 Subject: [PATCH] ci: Build ROM release from versioned git ref Signed-off-by: Benjamin Doron --- .github/workflows/fpga.yml | 17 ++ .github/workflows/fw-test-emu.yml | 10 ++ .../workflows/versioned-full-build-test.yml | 168 ++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 .github/workflows/versioned-full-build-test.yml diff --git a/.github/workflows/fpga.yml b/.github/workflows/fpga.yml index db2604eb77..e45ae74db8 100644 --- a/.github/workflows/fpga.yml +++ b/.github/workflows/fpga.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/fw-test-emu.yml b/.github/workflows/fw-test-emu.yml index b600ba6231..bfbd851897 100644 --- a/.github/workflows/fw-test-emu.yml +++ b/.github/workflows/fw-test-emu.yml @@ -10,6 +10,9 @@ on: extra-features: default: type: string + rom-ref: + default: "main" + type: string rom-logging: default: true type: boolean @@ -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 diff --git a/.github/workflows/versioned-full-build-test.yml b/.github/workflows/versioned-full-build-test.yml new file mode 100644 index 0000000000..53d78462a6 --- /dev/null +++ b/.github/workflows/versioned-full-build-test.yml @@ -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 "username@users.noreply.github.com" + 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