-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d5a42f1
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Spack buildcache build | ||
|
||
on: push | ||
|
||
env: | ||
SPACK_COLOR: always | ||
SPACK_BACKTRACE: please | ||
|
||
jobs: | ||
example: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Spack | ||
run: | | ||
git clone --depth=1 https://github.com/spack/spack.git | ||
echo "$PWD/spack/bin/" >> "$GITHUB_PATH" | ||
- name: Concretize | ||
run: spack -e . concretize | ||
|
||
- name: Install | ||
run: spack -e . install -j $(($(nproc) + 1)) --no-check-signature --fail-fast | ||
|
||
- name: Push packages and update index | ||
run: | | ||
spack -e . mirror set --push --oci-username haampie --oci-password "${{ secrets.GITHUB_TOKEN }}" spack-buildcache | ||
spack -e . buildcache push -j $(($(nproc) + 1)) --base-image ubuntu:22.04 --unsigned --update-index spack-buildcache | ||
if: always() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Spack buildcache for Github Actions | ||
|
||
This repo provides a buildcache to speed up Spack in your Github Actions. | ||
|
||
Currently it provides binaries for `%gcc@12 os=ubuntu22.04 target=x86_64_v2` | ||
|
||
To use it, add an environment `spack.yaml` to the root of your own repository | ||
|
||
```yaml | ||
spack: | ||
view: my_view | ||
specs: | ||
- [email protected] | ||
|
||
packages: | ||
all: | ||
require: '%gcc@12 target=x86_64_v2' | ||
|
||
mirrors: | ||
spack-buildcache: oci://ghcr.io/haampie/spack-buildcache | ||
``` | ||
and Spack install it in a Github Action: | ||
```yaml | ||
name: Build | ||
|
||
on: push | ||
|
||
env: | ||
SPACK_COLOR: always | ||
SPACK_BACKTRACE: please | ||
|
||
jobs: | ||
example: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Spack | ||
run: | | ||
git clone --depth=1 https://github.com/spack/spack.git | ||
echo "$PWD/spack/bin/" >> "$GITHUB_PATH" | ||
- name: Concretize | ||
run: spack -e . concretize | ||
|
||
- name: Install | ||
run: spack -e . install --no-check-signature | ||
|
||
- name: Run | ||
run: ./my_view/bin/python -c 'print("hello world")' | ||
``` | ||
## Caching your own binaries | ||
If you want to cache your own binaries too, add an additional mirror to your | ||
environment config: | ||
```yaml | ||
spack: | ||
|
||
... | ||
|
||
mirrors: | ||
spack-buildcache: oci://ghcr.io/haampie/spack-buildcache | ||
local-buildcache: oci://ghcr.io/<username>/spack-buildcache | ||
``` | ||
and push the environment's binaries to the local buildcache: | ||
```yaml | ||
jobs: | ||
exampe: | ||
steps: | ||
... | ||
- name: Push packages and update index | ||
run: | | ||
spack -e . mirror set --push --oci-username <username> --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache | ||
spack -e . buildcache push -j $(nproc) --base-image ubuntu:22.04 --unsigned --update-index local-buildcache | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
spack: | ||
specs: | ||
- autoconf | ||
- automake | ||
- bison | ||
- cmake | ||
- flex | ||
- git | ||
- libtool | ||
- m4 | ||
- meson | ||
- ninja | ||
- perl | ||
- [email protected] | ||
view: false | ||
concretizer: | ||
unify: false | ||
packages: | ||
all: | ||
require: '%gcc@12 target=x86_64_v2' | ||
mirrors: | ||
spack-buildcache: oci://ghcr.io/haampie/spack-buildcache |