{"id":20099029,"url":"https://github.com/spack/github-actions-buildcache","last_synced_at":"2025-03-02T16:41:30.621Z","repository":{"id":205051258,"uuid":"713283926","full_name":"spack/github-actions-buildcache","owner":"spack","description":"Spack build cache for Github Actions","archived":false,"fork":false,"pushed_at":"2024-12-20T08:59:47.000Z","size":47,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-02T06:47:39.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-02T07:58:55.000Z","updated_at":"2025-01-18T01:06:31.000Z","dependencies_parsed_at":"2024-04-24T20:45:53.703Z","dependency_job_id":"1480a979-1e98-4898-86d1-6a4a3286adab","html_url":"https://github.com/spack/github-actions-buildcache","commit_stats":null,"previous_names":["haampie/spack-buildcache","spack/spack-buildcache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fgithub-actions-buildcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fgithub-actions-buildcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fgithub-actions-buildcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fgithub-actions-buildcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spack","download_url":"https://codeload.github.com/spack/github-actions-buildcache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241541360,"owners_count":19979117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T17:07:51.162Z","updated_at":"2025-03-02T16:41:30.591Z","avatar_url":"https://github.com/spack.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spack buildcache for GitHub Actions\n\nThis repo provides a buildcache to speed up Spack in your GitHub Actions.\n\nCurrently it provides binaries from Spack `develop` for\n\n- `%gcc@9 ^glibc@2.31 target=x86_64_v3`\n- `%clang@12 ^glibc@2.31 target=x86_64_v3`\n\nwhich are compatible with\n\n- Ubuntu 20.04 and later\n- Debian 11 and later\n- RHEL 9 and later\n- Fedora 32 and later\n\nTo use it, add an environment `spack.yaml` to the root of your own repository\n\n```yaml\nspack:\n  view: my_view\n  specs:\n  - python@3.11\n\n  config:\n    install_tree:\n      root: /opt/spack\n\n  packages:\n    all:\n      require: 'target=x86_64_v3'\n```\n\nand Spack install it in a GitHub Action:\n\n```yaml\nname: Build\n\non: push\n\njobs:\n  example:\n    runs-on: ubuntu-22.04\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n\n    - name: Setup Spack\n      uses: spack/setup-spack@v2\n\n    - name: Concretize\n      run: spack -e . concretize\n\n    - name: Install\n      run: spack -e . install\n\n    - name: Run\n        run: ./my_view/bin/python3 -c 'print(\"hello world\")'\n```\n\n## Caching your own binaries\n\nIf you want to cache your own binaries too, there are three steps to take:\n\n1. Use padding in the install root, and add an additional mirror to `spack.yaml`:\n\n   ```yaml\n   spack:\n     config:\n       install_tree:\n         root: /opt/spack\n         padded_length: 128\n     mirrors:\n       local-buildcache:\n         url: oci://ghcr.io/\u003cusername\u003e/spack-buildcache\n         signed: false\n         access_pair:\n           id_variable: GITHUB_USER\n           secret_variable: GITHUB_TOKEN\n\n   ```\n\n2. Configure the permissions for `GITHUB_TOKEN`:\n\n   ```yaml\n   jobs:\n     example:\n       runs-on: ubuntu-22.04\n       permissions:\n         packages: write\n   ```\n\n3. Add an extra job step that pushes installed Spack packages to the local\n   buildcache:\n\n   ```yaml\n   jobs:\n     example:\n       steps:\n       - name: Push packages and update index\n         env:\n           GITHUB_USER: ${{ github.actor }}\n           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n         run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache\n         if: ${{ !cancelled() }}\n   ```\n   NOTE: Make sure to add `if: ${{ !cancelled() }}`, so that binaries for successfully\n   installed packages are available also when a dependent fails to build.\n\n### Caching your own binaries in *private* repos and buildcaches\n\nWhen your local buildcache is stored in a private GitHub package,\nyou need to specify the OCI credentials already *before* `spack concretize`.\nThis is because Spack needs to fetch the buildcache index.\n\n```yaml\nenv:\n  GITHUB_USER: ${{ github.actor }}\n  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\njobs:\n  example-private:\n    steps:\n    - name: Concretize\n      run: spack -e . concretize\n\n    - name: Install\n      run: spack -e . install\n\n    - name: Push packages and update index\n      run: spack -e . buildcache push --base-image ubuntu:22.04 --update-index local-buildcache\n```\n\nFrom a security perspective, do note that the `GITHUB_TOKEN` is exposed to every\njob step.\n\n## Contributing\n\nIf you want to make more packages available, contribute to\n[spack.yaml](spack.yaml).\n\n## Build strategy\n\nSince compiling software in GitHub actions is relatively slow, this stack is\nbuilt using `concretizer:reuse:dependencies`. That means that the latest\nversions of the packages listed in [spack.yaml](spack.yaml) are built, but\ntheir dependencies are only updated when a package compatibility rule requires\nit. The stack is currently built on demand, not on a schdule.\n\n## License\n\nThis project is part of Spack. Spack is distributed under the terms of both the\nMIT license and the Apache License (Version 2.0). Users may choose either\nlicense, at their option.\n\nAll new contributions must be made under both the MIT and Apache-2.0 licenses.\n\nSee LICENSE-MIT, LICENSE-APACHE, COPYRIGHT, and NOTICE for details.\n\nSPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nLLNL-CODE-811652\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspack%2Fgithub-actions-buildcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspack%2Fgithub-actions-buildcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspack%2Fgithub-actions-buildcache/lists"}