-
Notifications
You must be signed in to change notification settings - Fork 5
144 lines (126 loc) · 4.43 KB
/
spack.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build dependencies
on:
workflow_call:
inputs:
os:
required: true
type: string
image:
required: false
type: string
default: ""
xcode:
required: false
type: string
default: "latest-stable"
compiler:
required: false
type: string
default: ""
default:
required: false
type: boolean
default: false
jobs:
build:
runs-on: "${{ inputs.os }}"
container:
image: ${{ inputs.image == 'none' && '' || inputs.image }}
steps:
- uses: actions/checkout@v4
- name: Set up Spack
uses: spack/setup-spack@v2
- name: Apply spack patch
working-directory: spack
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
curl https://patch-diff.githubusercontent.com/raw/spack/spack/pull/47370.patch | git am
- name: Setup Xcode version
if: startsWith(inputs.os, 'macos')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ inputs.xcode }}"
- name: List visible compilers
run: |
spack compiler find
spack compilers
- name: Locate OpenGL
run: ./opengl.sh
- name: Remove packages to save disk
if: startsWith(inputs.os, 'ubuntu') && inputs.image == ''
run: |
df -h
sudo apt-get update
echo "Listing 25 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 25
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*' || true
sudo apt-get remove -y azure-cli || true
sudo apt-get remove -y google-cloud-cli || true
sudo apt-get remove -y google-chrome-stable || true
sudo apt-get remove -y firefox || true
sudo apt-get remove -y powershell || true
sudo apt-get remove -y mono-devel || true
sudo apt-get remove -y '^temurin.*' || true
sudo apt-get autoremove -y
sudo apt-get clean
rm -rf /usr/share/dotnet/
df -h
- name: Select compiler
if: inputs.compiler != ''
run: |
spack compilers | grep "${{ inputs.compiler }}"
spack -e . config add 'packages:all:require: ["%${{ inputs.compiler }}"]'
- name: Spack concretize
run: |
spack -e . concretize -Uf
spack -e . find
- name: Lockfile bookkeeping
shell: bash
run: |
arch=$(spack arch --family)
export TARGET_TRIPLET="${arch}_${{ inputs.compiler }}"
echo "TARGET_TRIPLET=${TARGET_TRIPLET}" >> "$GITHUB_ENV"
cp spack.lock "spack_${TARGET_TRIPLET}.lock"
if [[ "${{ inputs.default }}" == "true" ]]; then
# this will be become the default combination for this architecture
cp spack.lock "spack_${arch}.lock"
fi
- name: Upload lock files
uses: actions/upload-artifact@v4
if: always()
with:
name: spack_${{ env.TARGET_TRIPLET }}-locks
path: |
spack_*.lock
if-no-files-found: error
- name: Spack build
run: |
spack -e . install --no-check-signature --show-log-on-error
- name: Add lock files to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
spack_*.lock
- name: Push packages and update index
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && !cancelled()
env:
GH_OCI_USER: "${{ github.actor }}"
GH_OCI_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
shell: bash
run: |
if [[ "${{ inputs.image }}" != "" ]]; then
export BASE_IMAGE="${{ inputs.image }}"
elif [[ "${{ inputs.os }}" == "ubuntu-22.04" ]]; then
export BASE_IMAGE="ubuntu:22.04"
elif [[ "${{ inputs.os }}" == "ubuntu-24.04" ]]; then
export BASE_IMAGE="ubuntu:24.04"
else
export BASE_IMAGE="ubuntu:24.04"
fi
echo "BASE IMAGE: ${BASE_IMAGE}"
./retry.sh spack -e . buildcache push --base-image "${BASE_IMAGE}" --unsigned --update-index acts-spack-buildcache
# - uses: mxschmitt/action-tmate@v3
# if: failure()