{"id":20099036,"url":"https://github.com/spack/setup-spack","last_synced_at":"2025-05-06T06:30:48.373Z","repository":{"id":48915715,"uuid":"383070686","full_name":"spack/setup-spack","owner":"spack","description":"Github Action to setup Spack","archived":false,"fork":false,"pushed_at":"2025-04-16T12:01:14.000Z","size":68,"stargazers_count":17,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-05T04:04:36.358Z","etag":null,"topics":["actions","package-manager","spack"],"latest_commit_sha":null,"homepage":"https://github.com/spack/spack","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":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2021-07-05T08:35:28.000Z","updated_at":"2025-04-30T15:20:46.000Z","dependencies_parsed_at":"2024-03-15T19:51:31.660Z","dependency_job_id":"5c044407-887c-4322-a170-b5f649c7a743","html_url":"https://github.com/spack/setup-spack","commit_stats":null,"previous_names":["haampie-spack/setup-spack"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fsetup-spack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fsetup-spack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fsetup-spack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spack%2Fsetup-spack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spack","download_url":"https://codeload.github.com/spack/setup-spack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252633568,"owners_count":21779889,"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":["actions","package-manager","spack"],"created_at":"2024-11-13T17:07:52.004Z","updated_at":"2025-05-06T06:30:48.364Z","avatar_url":"https://github.com/spack.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup Spack in GitHub Actions\n\nSet up the [Spack package manager](https://github.com/spack/spack) with a default build cache to\nspeed up your actions.\n\n## Example: basic setup\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-22.04\n    steps:\n    - name: Set up Spack\n      uses: spack/setup-spack@v2\n      with:\n        ref: develop      # Spack version (examples: develop, releases/v0.23)\n        buildcache: true  # Configure oci://ghcr.io/spack/github-actions-buildcache\n        color: true       # Force color output (SPACK_COLOR=always)\n        path: spack       # Where to clone Spack\n    - run: spack install python\n```\n\nWhen `buildcache: true` is set, binaries from https://github.com/spack/github-actions-buildcache\nare used. For available software, [see here](https://github.com/spack/github-actions-buildcache/blob/main/spack.yaml).\n\n## Example: shell support\n\nIf you want to use shell-aware commands such as `spack env activate` and `spack load`,\nuse either `shell: spack-bash {0}` or `shell: spack-sh {0}` in your action:\n\n```yaml\n- name: Shell example\n  shell: spack-bash {0}\n  run: |\n    spack env activate .\n    spack env status\n```\n\nThese \"shells\" are small wrappers that run `. setup-env.sh` before executing your script.\n\n## Example: caching your own binaries for public repositories\n\nWhen you need to install packages not available in the default build cache, you can build them\nonce and then cache them on GitHub Packages.\n\nThe easiest way to do so is to create a `spack.yaml` environment in the root of your git\nrepository:\n\n```yaml\nspack:\n  view: /opt/view\n  specs:\n  - python@3.11\n\n  config:\n    install_tree:\n      root: /opt/spack\n      padded_length: 128\n\n  packages:\n    all:\n      require: 'target=x86_64_v3'\n\n  mirrors:\n    local-buildcache:\n      url: oci://ghcr.io/\u003cusername\u003e/spack-buildcache\n      binary: true\n      signed: false\n      access_pair:\n        id_variable: GITHUB_USER\n        secret_variable: GITHUB_TOKEN\n```\n\nThen configure an action like this:\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-22.04\n    permissions:\n      packages: write\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v4\n    \n    - name: Set up Spack\n      uses: spack/setup-spack@v2\n    \n    - name: Install\n      run: spack -e . install\n\n    - name: Run\n      shell: spack-bash {0}\n      run: |\n        spack env activate .\n        python3 -c 'print(\"hello world\")'\n\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\n## Example: caching your own binaries for private repositories\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## 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%2Fsetup-spack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspack%2Fsetup-spack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspack%2Fsetup-spack/lists"}