Skip to content

Commit

Permalink
Add stack config
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Feb 10, 2025
1 parent 649c2a6 commit d22eed5
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: # yamllint disable-line rule:truthy rule:comments
push:
branches:
- main
- stack

pull_request:
branches:
Expand Down Expand Up @@ -81,6 +82,70 @@ jobs:
# Let's test it overwrites successfully
cabal run pacer -- chart --data examples
stack:
strategy:
fail-fast: false
matrix:
os:
- "macos-latest"
- "ubuntu-latest"
- "windows-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup haskell
uses: haskell-actions/setup@v2
with:
enable-stack: true

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x

- name: Build
run: stack build --ghc-options -Werror

# yamllint disable rule:line-length
- name: Unit tests
id: unit
run: stack test unit --ghc-options -Werror --test-arguments '--hedgehog-tests 1000000'
# yamllint enable

- uses: actions/upload-artifact@v4
name: Unit tests upload
if: ${{ failure() && steps.unit.conclusion == 'failure' }}
with:
name: stack-unit-tests-artifacts
path: |
test/unit/goldens
- name: Functional tests
id: functional
run: stack test functional --ghc-options -Werror

- uses: actions/upload-artifact@v4
name: Functional tests upload
if: ${{ failure() && steps.functional.conclusion == 'failure' }}
with:
name: stack-functional-tests-artifacts
path: |
test/functional/goldens
- name: Generate charts html/hs

# TODO: It would be nice if we could test that the html page actually
# does what we want because it is possible for webpack to succeed yet
# the page is broken.
#
# It may be possible to require 0 console errors, though of course that
# could be overly restrictive.
run: |
stack run pacer -- chart --data examples
# Let's test it overwrites successfully
stack run pacer -- chart --data examples
nix:
strategy:
fail-fast: false
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ cabal.project.local

# pacer output
/build

# stack
/.stack-work
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [Scale](#scale)
- [Building](#building)
- [Cabal](#cabal)
- [Stack](#stack)
- [Nix](#nix)
- [FAQ](#faq)

Expand Down Expand Up @@ -272,6 +273,18 @@ cabal build --project-file cabal.ghc9101.project
>
> Freeze files are provided for only select compilers.
## Stack

### Prerequisites

* [`stack 3.1.1+`](https://docs.haskellstack.org/en/stable/)

Like `cabal` and `ghc`, `stack` can be installed with [`ghcup`](https://www.haskell.org/ghcup/).

### Build Pacer

Once you have `stack`, `pacer` can be built with `stack build` or installed globally (i.e. `~/.local/bin/pacer`) with `stack install`.

## Nix

### Prerequisites
Expand Down
22 changes: 21 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,31 @@
] ++ webDeps;
};

stack-wrapped = pkgs.symlinkJoin {
name = "stack";
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack --add-flags "--no-nix --system-ghc"
'';
};

webDeps = [ pkgs.nodejs_23 ];
in
{
packages.default = mkPkg false;
devShells.default = mkPkg true;

devShells = {
default = mkPkg true;

stack = pkgs.mkShell {
buildInputs = [
compiler.ghc
pkgs.zlib
stack-wrapped
];
};
};

apps = {
format = nix-hs-utils.mergeApps {
Expand Down
51 changes: 51 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
resolver: nightly-2025-02-09
packages:
- .
ghc-options:
"$locals": -Wall -Wcompat
-Widentities
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wmissing-deriving-strategies
-Wmissing-export-lists
-Wmissing-exported-signatures
-Wmissing-home-modules
-Wpartial-fields
-Wprepositive-qualified-module
-Wredundant-constraints
-Wunused-binds
-Wunused-packages
-Wunused-type-patterns
-Wno-missing-import-lists
-Wno-unticked-promoted-constructors
extra-deps:
- env-guard-0.2@sha256:4251503bde7549e267bd307f4b293c8c0ac48c6585968108e3e3fc5a3cfbb179,1312
- text-display-0.0.5.2@sha256:6e6a5bf1c83dfa6c34692ed5d8ea87f1bd385984309b42c302f2156f4d82477b,2670
- git: https://github.com/tbidne/algebra-simple.git
commit: 37ec7127fbd0f591d4539e4bf72a0badd7569181
- git: https://github.com/tbidne/bounds.git
commit: b7ca541cfdd8564bcebe5d38456fe7abf77885b8
- git: https://github.com/tbidne/effectful-libs.git
commit: 63713ede9a37754dff857900cc3fb38884c6afde
subdirs:
- lib/concurrent-effectful
- lib/fs-effectful
- lib/ioref-effectful
- lib/logger-effectful
- lib/logger-ns-effectful
- lib/optparse-effectful
- lib/terminal-effectful
- lib/time-effectful
- lib/typed-process-dynamic-effectful
- git: https://github.com/tbidne/exception-utils.git
commit: e28b28ae3bc90a0336abf69eff28369b790f4e13
- git: https://github.com/tbidne/fs-utils.git
commit: e2273c91c411e1fe12347524065855ba8e34a481
- git: https://github.com/tbidne/relative-time.git
commit: 6bd6c1208bcda9f5d5ecb7ff45fafb91929cdea8
- git: https://github.com/tbidne/smart-math.git
commit: a39c02ec6a5a9c4b551baffafd75f26be74dd457
allow-newer: true
allow-newer-deps:
- path
Loading

0 comments on commit d22eed5

Please sign in to comment.