Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better CI caching #203

Merged
merged 6 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/actions/cabal-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Cabal dependency and incremental build caches
runs:
using: composite
steps:
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.local/state/cabal/store/
key: cabal-${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
cabal-${{ runner.os }}
- name: Cache incremental build
uses: actions/cache@v3
with:
path: ./dist-newstyle/
key: dist-${{ runner.os }}-${{ github.sha }}
restore-keys: |
dist-${{ runner.os }}
16 changes: 6 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ jobs:
- uses: cachix/install-nix-action@v22
- run: nix develop -c cabal update
- run: nix develop -c cabal freeze
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: cabal-${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}
- uses: ./.github/actions/cabal-cache
- run: nix develop -c cabal build
test:
name: Test
Expand All @@ -35,10 +32,7 @@ jobs:
- uses: cachix/install-nix-action@v22
- run: nix develop -c cabal update
- run: nix develop -c cabal freeze
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: cabal-${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}
- uses: ./.github/actions/cabal-cache
- run: nix develop -c cabal test
lint:
name: Lint
Expand Down Expand Up @@ -71,5 +65,7 @@ jobs:
with:
path: ~/.cache/yarn/v6
key: yarn-${{ runner.os }}-${{ hashFiles('.golden/ts/yarn.lock') }}
- run: nix develop -c yarn install --frozen-lockfile
- run: nix develop -c yarn typecheck
restore-keys: |
yarn-${{ runner.os }}
- run: nix develop .#golden -c yarn install --frozen-lockfile
- run: nix develop .#golden -c yarn typecheck
5 changes: 1 addition & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ jobs:
with:
ghc-version: 9.4.6
- run: cabal freeze
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: cabal-${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}
- uses: ./.github/actions/cabal-cache
- name: Build
run: |
# Unlike `cabal build`, `cabal install` appears to build in a
Expand Down
29 changes: 17 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@

haskPkgs = pkgs.haskell.packages."${ghcVer}";
in {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cabal-install
haskell.compiler."${ghcVer}"
haskPkgs.haskell-language-server
hlint
haskPkgs.hspec-golden
stylish-haskell
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cabal-install
haskell.compiler."${ghcVer}"
haskPkgs.haskell-language-server
hlint
haskPkgs.hspec-golden
stylish-haskell
];
};

# For typechecking golden output
nodejs
yarn
];
golden = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
yarn
];
};
};
});
}