-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a149085
commit 281839d
Showing
2 changed files
with
92 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: chipyard-tutorials | ||
|
||
# TODO: figure out when to run tutorials | ||
on: | ||
# run ci on pull requests targeting following branches (runs on the merge commit) | ||
pull_request: | ||
branches: | ||
- main | ||
- '1.[0-9]*.x' | ||
|
||
# nicer shell to run commands in | ||
defaults: | ||
run: | ||
shell: bash -leo pipefail {0} | ||
|
||
env: | ||
CHIPYARD_DIR: ${{ secrets.BUILDDIR }}/cy-ci-shared/cy-${{ github.sha }} | ||
JAVA_TMP_DIR: /tmp/cy-${{ github.sha }}-full | ||
|
||
jobs: | ||
cancel-prior-workflows: | ||
name: cancel-prior-workflows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
setup-chipyard-tutorial: | ||
name: nice name | ||
needs: [cancel-prior-workflows] | ||
runs-on: as4 | ||
steps: | ||
# workaround actions/checkout not 'cleaning' submodules on new checkouts. see https://github.com/actions/checkout/issues/358 | ||
- name: Delete old checkout | ||
run: | | ||
rm -rf ${{ github.workspace }}/* || true | ||
rm -rf ${{ github.workspace }}/.* || true | ||
- uses: actions/checkout@v3 | ||
# copy repository to globally visible area (useful for if tutorials need to be split across multiple GH-A jobs). | ||
# in this case, a tutorial run is within a single GH-A job so you could just use the $GITHUB_WORKSPACE | ||
- name: Setup repository | ||
run: | | ||
git clone ${{ github.workspace }} $CHIPYARD_DIR | ||
mkdir $JAVA_TMP_DIR | ||
# TODO: should/could be autogenerated from the docs | ||
# a script with all the tutorial commands | ||
- name: Run tutorial | ||
run: | | ||
cd $CHIPYARD_DIR # cd's into globally visible directory 1st (otherwise would run out of the $GITHUB_WORKSPACE which is per-job) | ||
scripts/tutorial-first-verilog-build.sh | ||
- name: Delete repository (and other misc. data) | ||
if: ${{ always() }} # always run at the end | ||
run: | | ||
rm -rf ${{ env.REMOTE_WORK_DIR }} | ||
rm -rf ${{ env.JAVA_TMP_DIR }} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# exit script if any command fails | ||
set -e | ||
set -o pipefail | ||
|
||
# $CHIPYARD_DIR should be defined and pointing to the top-level folder in Chipyard | ||
if [[ -z "${CHIPYARD_DIR}" ]]; then | ||
echo "Environment variable \$CHIPYARD_DIR is undefined. Unable to run script." | ||
exit 1 | ||
fi | ||
|
||
cd $CHIPYARD | ||
|
||
# speed up setup | ||
export MAKEFLAGS="-j32" | ||
|
||
# run setup | ||
./build-setup.sh -f -v | ||
|
||
# use chipyard env | ||
source env.sh | ||
|
||
# build first set of verilog | ||
cd sims/verilator | ||
make verilog | ||
|
||
# build and make verilator binary for verilog built | ||
make | ||
|
||
# see verilog | ||
ls -alh generated-src | ||
|
||
# see verilator binary | ||
ls -alh simulator* |