11name : Generate outputs
22on :
33 workflow_call :
4+ inputs :
5+ with_pr_container :
6+ required : true
7+ type : boolean
48
59jobs :
610 re-generate :
1014 contents : write
1115
1216 steps :
13- - name : Remove pre-installed apps to make space for build
14- run : |
15- sudo apt-get remove -y '^llvm-.*'
16- sudo apt-get remove -y '^dotnet-.*'
17- sudo apt-get remove -y 'php.*'
18- sudo apt-get remove -y '^mongodb-.*'
19- sudo apt-get remove -y '^mysql-.*'
20- sudo apt-get autoremove -y
21- sudo apt-get clean
22- sudo rm -rf /usr/share/dotnet/
23- sudo rm -rf /usr/local/share/powershell
24- sudo rm -rf /usr/local/share/chromium
25- sudo rm -rf /usr/local/lib/android
26- sudo rm -rf /usr/local/lib/node_modules
27- sudo docker system prune -af
28-
2917 - name : Checkout (Push)
3018 if : github.event_name != 'pull_request'
3119 uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
@@ -40,32 +28,34 @@ jobs:
4028 repository : ${{ github.event.pull_request.head.repo.full_name }}
4129
4230 - name : Download container from artifact if PR
43- if : github.event_name == 'pull_request' && needs.container.result == 'success'
31+ if : github.event_name == 'pull_request' && inputs.with_pr_container
4432 uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
4533 with :
4634 name : tutorial-container
4735 path : /tmp
4836
4937 - name : Import container from PR artifact
50- if : github.event_name == 'pull_request' && needs.container.result == 'success'
38+ if : github.event_name == 'pull_request' && inputs.with_pr_container
5139 run : |
5240 docker load --input /tmp/tutorial-container.tar
5341 docker image ls -a
5442
5543 - name : Re-generate outputs from tutorial scripts
5644 run : |
5745 chmod -R a+w outputs
58- make -C outputs -j $(nproc) DOCKER_RUN_OPTS="-e COLUMNS=94 -e COLIFY_SIZE=24x94" container=ghcr.io/spack/tutorial
46+ mkdir spack-home && sudo chown -R 1000:1000 spack-home
47+ DOCKER_RUN_OPTS="-e COLUMNS=94 -e COLIFY_SIZE=24x94 -v $(pwd)/spack-home:/home/spack"
48+ make -C outputs -j $(nproc) DOCKER_RUN_OPTS="$DOCKER_RUN_OPTS" container=ghcr.io/spack/tutorial
5949
6050 - name : Show diff of modified files
6151 run : |
62- git diff HEAD .
52+ git diff HEAD outputs/
6353
6454 - name : Push modified files to branch
6555 if : ( github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork )
6656 run : |
6757 git config user.name "github-actions[bot]"
6858 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
69- git add .
59+ git add outputs/
7060 git commit -m "Update generated outputs on behalf of [@${{ github.actor }}]"
7161 git push
0 commit comments