Skip to content

Commit

Permalink
Add sw-emulator workflow...
Browse files Browse the repository at this point in the history
  • Loading branch information
korran committed Nov 21, 2023
1 parent 7618a8f commit e91a970
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/fpga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ jobs:
- name: 'Upload test results'
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: caliptra-test-results${{ inputs.artifact-suffix }}
path: |
Expand Down
97 changes: 97 additions & 0 deletions .github/workflows/fw-test-emu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

name: Build and Test Firmware (in emulator)

on:
workflow_call:
inputs:
artifact-suffix:
type: string
required: false
trng:
default: external
type: string
rom-logging:
default: true
type: boolean

jobs:
build_and_test:
runs-on: ubuntu-22.04

env:
NEXTEST_VERSION: 0.9.62
CACHE_BUSTER: f7c64774f17c

steps:
- name: Restore cargo-nextest binary
uses: actions/cache/restore@v3
id: nextest_bin_restore
with:
path: ~/.cargo/bin/cargo-nextest
key: nextest-bin-${{ env.NEXTEST_VERSION}}-${{ env.CACHE_BUSTER }}

- name: Install cargo-nextest
if: steps.nextest_bin_restore.outputs.cache-hit != 'true'
run: |
cargo install cargo-nextest --version ${NEXTEST_VERSION} --locked --no-default-features --features=default-no-update
- name: Save cargo-nextest binary
uses: actions/cache/save@v3
if: steps.nextest_bin_restore.outputs.cache-hit != 'true'
with:
path: ~/.cargo/bin/cargo-nextest
key: ${{ steps.nextest_bin_restore.outputs.cache-primary-key }}

- name: Checkout repo
uses: actions/checkout@v3

- name: Pull dpe submodule
run: |
git submodule update --init dpe
- name: Build firmware
run: |
mkdir /tmp/caliptra-firmware
cargo run -p caliptra-builder -- --all_elfs /tmp/caliptra-firmware
- name: Run tests
run: |
export CALIPTRA_PREBUILT_FW_DIR=/tmp/caliptra-test-firmware
FEATURE_FLAG=
if [ "${{ inputs.trng }}" == "external" ] || [ -z "${{ inputs.trng }}" ]; then
echo Using external TRNG
elif [ "${{ inputs.trng }}" == "internal" ]; then
echo Using internal TRNG
FEATURE_FLAG="--features=itrng"
else
echo "Unexpected inputs.trng: ${{ inputs.rom-logging }}"
fi
if [ "${{ inputs.rom-logging }}" == "true" ] || [ -z "${{ inputs.rom-logging }}" ]; then
export CPTRA_ROM_TYPE=ROM_WITH_UART
elif [ "${{ inputs.rom-logging }}" == false ]; then
export CPTRA_ROM_TYPE=ROM_WITHOUT_UART
else
echo "Unexpected inputs.rom-logging: ${{ inputs.rom-logging }}"
exit 1
fi
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
cargo-nextest nextest list "${FEATURE_FLAG}" --message-format json > /tmp/nextest-list.json
cargo-nextest nextest run "${FEATURE_FLAG}" \
--no-fail-fast \
--profile=nightly
- name: 'Upload test results'
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: caliptra-test-results${{ inputs.artifact-suffix }}
path: |
/tmp/junit.xml
/tmp/nextest-list.json
68 changes: 55 additions & 13 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,67 @@ jobs:
# echo "release_ref=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
# echo "Current ref $(git rev-parse HEAD) will receive tag ${TAG_BASE}${INDEX} after tests"

fpga-full-suite-etrng-log:
name: FPGA Suite (etrng, log)
# fpga-full-suite-etrng-log:
# name: FPGA Suite (etrng, log)
## needs: find-latest-release
## if: needs.find-latest-release.outputs.create_release
# uses: ./.github/workflows/fpga.yml
# with:
# artifact-suffix: -fpga-realtime-etrng-log
# trng: external
# rom-logging: true
#
# fpga-full-suite-etrng-nolog:
# name: FPGA Suite (etrng, nolog)
## needs: find-latest-release
## if: needs.find-latest-release.outputs.create_release
# uses: ./.github/workflows/fpga.yml
# with:
# artifact-suffix: -fpga-realtime-etrng-nolog
# trng: external
# rom-logging: false

sw-emulator-full-suite-etrng-log:
name: sw-emulator Suite (etrng, log)
# needs: find-latest-release
# if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -fpga-realtime-etrng-log
artifact-suffix: -sw-emulator-realtime-etrng-log
trng: external
rom-logging: true

fpga-full-suite-etrng-nolog:
name: FPGA Suite (etrng, nolog)
# needs: find-latest-release
# if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-etrng-nolog
trng: external
rom-logging: false
# sw-emulator-full-suite-etrng-nolog:
# name: sw-emulator Suite (etrng, nolog)
## needs: find-latest-release
## if: needs.find-latest-release.outputs.create_release
# uses: ./.github/workflows/fw-test-emu.yml
# with:
# artifact-suffix: -sw-emulator-realtime-etrng-nolog
# trng: external
# rom-logging: false
#
# sw-emulator-full-suite-itrng-log:
# name: sw-emulator Suite (itrng, log)
## needs: find-latest-release
## if: needs.find-latest-release.outputs.create_release
# uses: ./.github/workflows/fw-test-emu.yml
# with:
# artifact-suffix: -sw-emulator-realtime-itrng-log
# trng: internal
# rom-logging: true
#
# sw-emulator-full-suite-itrng-nolog:
# name: sw-emulator Suite (itrng, nolog)
## needs: find-latest-release
## if: needs.find-latest-release.outputs.create_release
# uses: ./.github/workflows/fw-test-emu.yml
# with:
# artifact-suffix: -sw-emulator-realtime-itrng-nolog
# trng: internal
# rom-logging: false





Expand Down

0 comments on commit e91a970

Please sign in to comment.