-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scheduled actions can only be done on the main branch, which is why a workflow_dispatch is used. Signed-off-by: Arthur Heymans <[email protected]>
- Loading branch information
1 parent
a476f51
commit 79ec0b0
Showing
1 changed file
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,55 @@ 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" | ||
find-latest-release-2_x: | ||
name: Find Latest Release 2.x | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
create_release: ${{ steps.find.outputs.create_release }} | ||
new_release_tag: ${{ steps.find.outputs.new_release_tag }} | ||
release_ref: ${{ steps.find.outputs.release_ref }} | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main-2.x | ||
submodules: 'true' | ||
fetch-depth: 0 | ||
|
||
- name: Find latest release | ||
id: find | ||
run: | | ||
DATE="$(date +'%Y%m%d')" | ||
TAG_PREFIX="release_v" | ||
TAG_BASE="${TAG_PREFIX}${DATE}_" | ||
INDEX=0 | ||
while git tag | grep ${TAG_BASE}${INDEX}; do | ||
((INDEX+=1)) | ||
done | ||
git submodule update --remote hw/latest/rtl | ||
CHECK_RELEASE_SYNC=$(git status --porcelain | head -1) | ||
MOST_RECENT_RELEASE=None | ||
if git tag | grep ${TAG_PREFIX} > /dev/null; then | ||
MOST_RECENT_RELEASE=$(git tag | grep ${TAG_PREFIX} | sort -r | head -1) | ||
fi | ||
if [ "$MOST_RECENT_RELEASE" == "None" ] && [ !"$CHECK_RELEASE_SYNC" ]; then | ||
echo "create_release=true" >> $GITHUB_OUTPUT | ||
else | ||
COMMITS_AFTER_LAST_RELEASE=$(git rev-list --count $MOST_RECENT_RELEASE..HEAD) | ||
if [[ $COMMITS_AFTER_LAST_RELEASE -gt 0 ]]; then | ||
echo "create_release=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "create_release=false" >> $GITHUB_OUTPUT | ||
fi | ||
fi | ||
echo "new_release_tag=${TAG_BASE}${INDEX}-2.x" >> $GITHUB_OUTPUT | ||
echo "release_ref=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
echo "Current ref $(git rev-parse HEAD) will receive tag ${TAG_BASE}${INDEX}-2.x after tests" | ||
fpga-1_0-full-suite-etrng-log: | ||
name: FPGA Suite (1.0, etrng, log) | ||
needs: find-latest-release | ||
|
@@ -248,6 +297,46 @@ jobs: | |
extra-features: slow_tests,itrng | ||
rom-logging: false | ||
|
||
sw-emulator-hw-latest-full-suite-etrng-log-2_x: | ||
name: sw-emulator Suite (etrng, log) 2_x | ||
needs: find-latest-release-2_x | ||
if: needs.find-latest-release-2_x.outputs.create_release | ||
uses: ./.github/workflows/fw-test-emu.yml | ||
with: | ||
artifact-suffix: -sw-emulator-hw-latest-etrng-log | ||
extra-features: slow_tests | ||
rom-logging: true | ||
|
||
sw-emulator-hw-latest-full-suite-etrng-nolog-2_x: | ||
name: sw-emulator Suite (etrng, nolog) 2_x | ||
needs: find-latest-release-2_x | ||
if: needs.find-latest-release-2_x.outputs.create_release | ||
uses: ./.github/workflows/fw-test-emu.yml | ||
with: | ||
artifact-suffix: -sw-emulator-hw-latest-etrng-nolog | ||
extra-features: slow_tests | ||
rom-logging: false | ||
|
||
sw-emulator-hw-latest-full-suite-itrng-log-2_x: | ||
name: sw-emulator Suite (itrng, log) 2_x | ||
needs: find-latest-release-2_x | ||
if: needs.find-latest-release-2_x.outputs.create_release | ||
uses: ./.github/workflows/fw-test-emu.yml | ||
with: | ||
artifact-suffix: -sw-emulator-hw-latest-itrng-log | ||
extra-features: slow_tests,itrng | ||
rom-logging: true | ||
|
||
sw-emulator-hw-latest-full-suite-itrng-nolog-2_x: | ||
name: sw-emulator Suite (itrng, nolog) 2_x | ||
needs: find-latest-release-2_x | ||
if: needs.find-latest-release-2_x.outputs.create_release | ||
uses: ./.github/workflows/fw-test-emu.yml | ||
with: | ||
artifact-suffix: -sw-emulator-hw-latest-itrng-nolog | ||
extra-features: slow_tests,itrng | ||
rom-logging: false | ||
|
||
sw-emulator-rom-1_1-full-suite-etrng-log: | ||
name: sw-emulator Suite (etrng, log) | ||
needs: find-latest-release | ||
|
@@ -421,3 +510,66 @@ jobs: | |
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
create-release-2_x: | ||
name: Create New Release 2_x | ||
needs: | ||
- find-latest-release-2_x | ||
- sw-emulator-hw-latest-full-suite-etrng-log-2_x | ||
- sw-emulator-hw-latest-full-suite-etrng-nolog-2_x | ||
- sw-emulator-hw-latest-full-suite-itrng-log-2_x | ||
- sw-emulator-hw-latest-full-suite-itrng-nolog-2_x | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
ref: ${{ needs.find-latest-release-2_x.outputs.release_ref }} | ||
|
||
- name: Generate release zip | ||
run: | | ||
./ci-tools/release/build_release.sh ${{ needs.find-latest-release-2_x.outputs.new_release_tag }} | ||
mv ./release/release.zip ./release/caliptra_${{ needs.find-latest-release-2_x.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-2_x.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-2_x.outputs.new_release_tag }} | ||
git push origin ${{ needs.find-latest-release-2_x.outputs.new_release_tag }} | ||
- name: Upload release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./release/caliptra_${{ needs.find-latest-release-2_x.outputs.new_release_tag }}.zip | ||
./release/test_artifacts_${{ needs.find-latest-release-2_x.outputs.new_release_tag }}.zip | ||
tag_name: ${{ needs.find-latest-release-2_x.outputs.new_release_tag }} | ||
prerelease: true | ||
|
||
- name: Write artifact to workflow with release info | ||
run: | | ||
mkdir /tmp/release-info-2_x | ||
echo "${{ needs.find-latest-release-2_x.outputs.new_release_tag }}" > /tmp/release-info-2_x/tag-name | ||
echo "caliptra_${{ needs.find-latest-release-2_x.outputs.new_release_tag }}.zip" > /tmp/release-info-2_x/zip-file-name | ||
- name: Write artifact with release info | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-info-2_x | ||
path: /tmp/release-info-2_x |