Simplified CI for tutorials + Tutorial Docs #4
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
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} | |
jobs: | |
cancel-prior-workflows: | |
name: Cancel Prior Workflows | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
# example of running a tutorial given a pre-made script | |
first-verilog-build-tutorial: | |
name: First Verilog Build Tutorial | |
needs: [cancel-prior-workflows] | |
runs-on: as4 | |
env: | |
CHIPYARD_DIR: ${{ github.workspace }} | |
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 | |
# a script with all the tutorial commands | |
- name: Run tutorial | |
run: | | |
scripts/tutorial-first-verilog-build.sh | |
# example of running a tutorial from an auto-generated script built from .rst | |
first-verilog-build-automated-tutorial: | |
name: First Verilog Build Automated Tutorial | |
needs: [cancel-prior-workflows] | |
runs-on: as4 | |
env: | |
CHIPYARD_DIR: ${{ github.workspace }} | |
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 | |
# run the autogenerated script with all the tutorial commands | |
- name: Run tutorial | |
run: | | |
scripts/generate-script-from-tutorial-rst.py docs/Tutorials/First-Verilog-Build.rst tutorial.sh | |
echo "Created tutorial.sh >>>" && cat tutorial.sh && echo "<<< Done tutorial.sh" | |
chmod +x tutorial.sh | |
./tutorial.sh |