Skip to content

Commit baa276e

Browse files
committed
ci: enable output generation for tutorial
1 parent a4406d3 commit baa276e

6 files changed

Lines changed: 33 additions & 55 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ jobs:
5050
needs: changes
5151
uses: ./.github/workflows/container.yml
5252

53-
# outputs:
54-
# if: |
55-
# !cancelled()
56-
# && contains(needs.*.result, 'success')
57-
# && !contains(needs.*.result, 'failure')
58-
# && (needs.changes.outputs.outputs == 'true'
59-
# || startsWith(github.ref, 'refs/tags/'))
60-
# needs: [ changes, container ]
61-
# uses: ./.github/workflows/outputs.yml
53+
outputs:
54+
if: |
55+
!cancelled()
56+
&& contains(needs.*.result, 'success')
57+
&& !contains(needs.*.result, 'failure')
58+
&& (needs.changes.outputs.outputs == 'true'
59+
|| startsWith(github.ref, 'refs/tags/'))
60+
needs: [ changes, container ]
61+
uses: ./.github/workflows/outputs.yml
62+
with:
63+
with_pr_container: ${{ needs.container.result == 'success' }}
6264

6365
style:
6466
if: ${{ needs.changes.outputs.style == 'true' }}

.github/workflows/container.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,6 @@ jobs:
1010
packages: write
1111

1212
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-
2813
- name: Set up QEMU
2914
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
3015

.github/workflows/outputs.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Generate outputs
22
on:
33
workflow_call:
4+
inputs:
5+
with_pr_container:
6+
required: true
7+
type: boolean
48

59
jobs:
610
re-generate:
@@ -10,22 +14,6 @@ jobs:
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 && sudo chown -R 1000:1000 spack
47+
DOCKER_RUN_OPTS="-e COLUMNS=94 -e COLIFY_SIZE=24x94 -v $(pwd)/spack:/home/spack/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

container/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@ ENV DEBIAN_FRONTEND=noninteractive
55
# Install AWS cli
66
RUN apt-get update -y && \
77
apt-get install -y --no-install-recommends \
8-
awscli \
98
bash-completion \
9+
ca-certificates \
1010
emacs \
1111
jq \
1212
less \
13-
vim
13+
vim \
14+
rclone
1415

1516
# Remove GCC 12 from container
1617
RUN apt-get remove -y gcc-12
1718

1819
# Download the buildcache
1920
RUN mkdir /mirror
20-
RUN aws --region us-east-1 --no-sign-request s3 sync --only-show-errors s3://spack-binaries/releases/v0.23/tutorial /mirror
21+
RUN rclone copy :s3:spack-binaries/v0.23.1/tutorial /mirror
2122

2223
RUN chmod -R go+r /mirror
2324

outputs/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sections := environments
2525
run_targets := $(addprefix run-,$(sections))
2626

2727
# Entrypoint
28-
update-outputs: #run
28+
update-outputs: run
2929
echo "Filtering raw outputs though col"
3030
for raw in raw/*/*.out; do \
3131
out=$$(echo $$raw | sed 's.raw/..'); \
@@ -34,17 +34,17 @@ update-outputs: #run
3434

3535
run: run-scripting
3636

37-
run-scripting: run-cache scripting.sh
38-
run-cache: run-dev cache.sh
37+
run-scripting: run-dev scripting.sh
38+
# run-cache: run-dev cache.sh
3939
run-dev: run-packaging dev.sh
4040
run-packaging: run-stacks packaging.sh
4141
run-stacks: run-environments stacks.sh
4242
run-environments: run-basics environments.sh
4343
run-basics: basics.sh init_spack.sh defs.sh
4444

4545
local: local-scripting
46-
local-scripting: local-cache scripting.sh
47-
local-cache: local-dev cache.sh
46+
local-scripting: local-dev scripting.sh
47+
# local-cache: local-dev cache.sh
4848
local-dev: local-packaging dev.sh
4949
local-packaging: local-stacks packaging.sh
5050
local-stacks: local-environments stacks.sh

outputs/packaging.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ example packaging/checksum-mpileaks-1 "spack checksum tutorial-mpileaks 1.0"
2020

2121
example --expect-error packaging/install-mpileaks-1 "spack install tutorial-mpileaks"
2222

23-
cp "$PROJECT/package-py-files/1.package.py" "$mpileaks_package_py"
24-
example packaging/info-mpileaks "spack info tutorial-mpileaks"
23+
#cp "$PROJECT/package-py-files/1.package.py" "$mpileaks_package_py"
24+
#example packaging/info-mpileaks "spack info tutorial-mpileaks"
2525

2626
cp "$PROJECT/package-py-files/2.package.py" "$mpileaks_package_py"
2727
example --expect-error packaging/install-mpileaks-2 "spack install tutorial-mpileaks"

0 commit comments

Comments
 (0)