-
Notifications
You must be signed in to change notification settings - Fork 665
89 lines (83 loc) · 3.57 KB
/
chipyard-tutorials.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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 }}
# 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
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
# 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 }}
# 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
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
# run the autogenerated 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/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
- 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 }}