Files
archived-teslamate/.github/workflows/ensure_linting.yml
T
JakobLichterfeld 6eab1575a9 ci: switch to cache-nix-action as Magic Nix Cache is deprecated (#4626)
* ci: switch to cache-nix-action as Magic Nix Cache is kind of deprecated

see #4544 for more information

* docs: update changelog

* docs: update changelog

* ci: update Nix installation and caching strategy in update-flake-lock

- Switch to nixbuild/nix-quick-install-action for Nix installation
- Implement caching with nix-community/cache-nix-action for improved performance
- Configure cache restoration and garbage collection settings
2025-04-05 09:47:39 +02:00

42 lines
1.6 KiB
YAML

name: Ensure Linting
on:
workflow_call:
permissions:
contents: read
jobs:
check_linting:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Nix
uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
- name: Nix binary cache
uses: nix-community/cache-nix-action@c448f065ba14308da81de769632ca67a3ce67cf5 # v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-created: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- name: Run treefmt in CI mode
run: nix develop --override-input devenv-root "file+file://"<(printf %s "$PWD") . --command treefmt --ci
# or use: https://github.com/cachix/git-hooks.nix?tab=readme-ov-file