Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
korran authored Jul 18, 2023
2 parents 508b859 + 1f6f56b commit afd5b05
Show file tree
Hide file tree
Showing 113 changed files with 5,603 additions and 514 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-test-verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: ["main"]
pull_request:

workflow_call:
workflow_dispatch:

jobs:
Expand All @@ -28,7 +29,8 @@ jobs:
EXTRA_CARGO_CONFIG: "target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"

steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'true'

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: ["main"]
pull_request:

workflow_call:
workflow_dispatch:

jobs:
Expand All @@ -26,7 +27,12 @@ jobs:
EXTRA_CARGO_CONFIG: "target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"

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

- name: Test commit name
run: |
echo "Build-Test: release_ref=$(git rev-parse HEAD)"
- name: Restore sccache binary
uses: actions/cache/restore@v3
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Nightly Release

on:
workflow_dispatch:
schedule:
# 2:11 AM PST tuesday-saturday
- cron: '11 10 * * 2-6'
permissions:
contents: write

jobs:
# Disable RTL-Repo-Sync until manual fixes to work with the latest RTL are not made
#rtl-repo-sync:
# name: RTL Repo Sync
# uses: ./.github/workflows/rtl-repo-sync.yml

find-latest-release:
name: Find Latest Release
#needs: rtl-repo-sync
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 }}

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
ref: 'main'
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
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" ]]; 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}" >> $GITHUB_OUTPUT
echo "release_ref=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "Current ref $(git rev-parse HEAD) will receive tag ${TAG_BASE}${INDEX} after tests"
verilator-full-suite:
name: Nightly Verilator Suite
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/nightly-verilator.yml


create-release:
name: Create New Release
needs: [find-latest-release, verilator-full-suite]
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
ref: ${{ needs.find-latest-release.outputs.release_ref }}

- 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: 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
tag_name: ${{ needs.find-latest-release.outputs.new_release_tag }}
4 changes: 3 additions & 1 deletion .github/workflows/nightly-verilator.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Verilator Nightly
on:
workflow_call:
workflow_dispatch:
schedule:
# 2:11 AM PST tuesday-saturday
Expand All @@ -18,7 +19,8 @@ jobs:
CACHE_BUSTER: 29334de42083

steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'true'

Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/rtl-repo-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: RTL Repo Sync

on:
workflow_call:
workflow_dispatch:

jobs:
update-rtl:
name: Update RTL Submodule
runs-on: ubuntu-22.04
outputs:
branch_name: ${{ steps.branch.outputs.branch }}
ci_checks_needed: ${{ steps.status.outputs.status }}
branch_base_ref: ${{ steps.commit.outputs.branch_base_ref }}
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
with:
submodules: 'true'
ref: 'main'

- name: Update the Caliptra RTL submodule and rebuild registers
run: |
echo "RTL-REPO-SYNC: release_ref=$(git rev-parse HEAD)"
git submodule update --remote hw-latest/caliptra-rtl
./registers/update.sh
- name: Find available branch name
id: branch
run: |
BRANCH_BASE=ci_rtl_${{ steps.date.outputs.date }}
INDEX=0
while git ls-remote --exit-code --heads origin ${BRANCH_BASE}_${INDEX}
do
((INDEX+=1))
done
echo "branch=${BRANCH_BASE}_${INDEX}" >> $GITHUB_OUTPUT
- name: Run git status
id: status
run: echo "status=$(git status -s | head -1)" >> $GITHUB_OUTPUT

# If there's a new HW release (submodule has been updated), add a commit to main branch
- name: Commit changes
id: commit
if: ${{ steps.status.outputs.status }}
run: |
git config --global user.name "GitHub CI"
git config --global user.email "[email protected]"
echo "branch_base_ref=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
git checkout -b ${{ steps.branch.outputs.branch }}
git commit -a -m "CI: Update Caliptra RTL"
git push -u origin ${{ steps.branch.outputs.branch }}
build-test:
uses: ./.github/workflows/build-test.yml
needs: update-rtl
if: needs.update-rtl.outputs.ci_checks_needed

build-test-verilator:
uses: ./.github/workflows/build-test-verilator.yml
needs: update-rtl
if: needs.update-rtl.outputs.ci_checks_needed

merge-rtl-update:
name: Merge RTL Update
needs: [update-rtl, build-test, build-test-verilator]
if: needs.update-rtl.outputs.ci_checks_needed
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
ref: 'main'
fetch-depth: 0

- name: Merge RTL changes to main branch
run: |
git config --global user.name "GitHub CI"
git config --global user.email "[email protected]"
if [[ "${{ needs.update-rtl.outputs.branch_base_ref }}" != $(git rev-parse HEAD) ]]; then
echo "Commit added to main after CI RTL branch test started; cannot auto-merge branch"
exit 1
fi
git push origin ${{ needs.update-rtl.outputs.branch_name }} main
git push origin --delete ${{ needs.update-rtl.outputs.branch_name }}
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
[submodule "runtime/dpe"]
path = runtime/dpe
url = https://github.com/chipsalliance/caliptra-dpe.git
branch = main
branch = main
[submodule "hw-latest/caliptra-rtl-fpga"]
path = hw-latest/caliptra-rtl-fpga
url = https://github.com/chipsalliance/caliptra-rtl
Loading

0 comments on commit afd5b05

Please sign in to comment.