{"id":15063830,"url":"https://github.com/andreabedini/cabal-cache-native","last_synced_at":"2025-04-10T11:26:19.392Z","repository":{"id":247910452,"uuid":"823944984","full_name":"andreabedini/cabal-cache-native","owner":"andreabedini","description":"Native GitHub Action cache for your cabal project","archived":false,"fork":false,"pushed_at":"2025-02-03T11:49:10.000Z","size":1875,"stargazers_count":8,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T17:09:23.075Z","etag":null,"topics":["actions","cache","haskell"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreabedini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-04T04:12:07.000Z","updated_at":"2025-02-01T19:02:09.000Z","dependencies_parsed_at":"2024-07-11T09:18:54.016Z","dependency_job_id":"10232bfb-9b28-4223-9df1-bdf80f6f71db","html_url":"https://github.com/andreabedini/cabal-cache-native","commit_stats":null,"previous_names":["andreabedini/cabal-cache-native"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabedini%2Fcabal-cache-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabedini%2Fcabal-cache-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabedini%2Fcabal-cache-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreabedini%2Fcabal-cache-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreabedini","download_url":"https://codeload.github.com/andreabedini/cabal-cache-native/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208621,"owners_count":21065203,"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","cache","haskell"],"created_at":"2024-09-25T00:07:45.648Z","updated_at":"2025-04-10T11:26:19.370Z","avatar_url":"https://github.com/andreabedini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cabal-cache-native\n\nThis action caches the build dependencies of a Haskell project with\nper-package granularity. It works out of the box and it is really fast.\n\n## Usage\n\nWhen building a Haskell project with cabal, cabal caches the project\ndependencies in a global cache called the \"store\". These are identified\nby a key that accurately represents their build configuration so they\ncan be shared between projects.\n\nUsing [@actions/cache](https://github.com/actions/cache) to cache the\nentire store is not optimal because it would either cache the entirety\nof the store or nothing at all; which cabal does already at keeping\ntrack of what can be shared between builds and what can't.\n\nThe complexity of the example workflow from [haskell-actions/setup](https://github.com/haskell-actions/setup/blob/ec49483bfc012387b227434aba94f59a6ecd0900/README.md#model-cabal-workflow-with-caching) is a testament to this issue.\n\n## Features\n\n- **Automatic**: the action detects the project's dependencies directly from cabal's build plan and caches them automatically.\n- **Fast**: the cache is stored in GitHub's own cache and it is restored very quickly.\n- **Accurate**: the cached packages are identified by the same package-hash used by cabal, allowing GitHub to garbage-collect them individually when they are not needed anymore.\n\n## Usage\n\nTo use this action you need to get cabal to create a build plan (i.e. the `plan.json` file). This is typically achieved by passing the `--dry-run` flag to the build command. Once `plan.json` has been created, `cabal-cache-native` will read from it the ids of the units to restore from cache. The action will look for `plan.json` in `${project-path}/${plan-json}`.\n\n```yaml\njobs:\n  build:\n    steps:\n      - uses: haskell-actions/setup\n        id: setup\n\n      # ...\n\n      # This step is required to generate the build plan\n      - run: cabal build all --dry-run\n\n      - uses: andreabedini/cabal-cache-native\n        with:\n          # required\n          store-path: ${{ steps.setup.outputs.cabal-store }}\n\n          # optional, the path to the project\n          # project-path: .\n\n          # optional, you can also specify the exact location of plan.json\n          # plan-json: dist-newstyle/cache/plan.json\n\n          # optional, use this to separate caches or to start from scratch.\n          # cache-key-prefix: cabal\n\n          # optional, use this ghc to locate ghc-pkg\n          # ghc: ghc\n\n          # optional, use this ghc-pkg\n          # ghc-pkg: ghc-pkg\n\n      # No need to check for cache hits, just build your project!\n      - run: cabal build all\n```\n\nNOTE: `cabal build` has to be the same command you use to build (plus\n`--dry-run`) otherwise you risk caching the wrong dependencies. This should not\ncause build failures, but it will cause unnecessary recompilations.\n\n## License\n\nYou are welcome to use this under the MIT license included in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabedini%2Fcabal-cache-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreabedini%2Fcabal-cache-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabedini%2Fcabal-cache-native/lists"}