From d22eed5314853437f36193d8d69f0fdce516e18e Mon Sep 17 00:00:00 2001 From: Tommy Bidne Date: Tue, 14 Jan 2025 00:50:33 +1300 Subject: [PATCH] Add stack config --- .github/workflows/ci.yaml | 65 ++++++++++++ .gitignore | 3 + README.md | 13 +++ flake.nix | 22 +++- stack.yaml | 51 ++++++++++ stack.yaml.lock | 209 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 362 insertions(+), 1 deletion(-) create mode 100644 stack.yaml create mode 100644 stack.yaml.lock diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d737c19..adf2624 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,6 +5,7 @@ on: # yamllint disable-line rule:truthy rule:comments push: branches: - main + - stack pull_request: branches: @@ -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 diff --git a/.gitignore b/.gitignore index 361676c..6041842 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ cabal.project.local # pacer output /build + +# stack +/.stack-work diff --git a/README.md b/README.md index 6277b82..efb5bc0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ - [Scale](#scale) - [Building](#building) - [Cabal](#cabal) + - [Stack](#stack) - [Nix](#nix) - [FAQ](#faq) @@ -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 diff --git a/flake.nix b/flake.nix index a1696ae..ebd268d 100644 --- a/flake.nix +++ b/flake.nix @@ -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 { diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..e31a9f1 --- /dev/null +++ b/stack.yaml @@ -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 diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..2b64dc3 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,209 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: env-guard-0.2@sha256:4251503bde7549e267bd307f4b293c8c0ac48c6585968108e3e3fc5a3cfbb179,1312 + pantry-tree: + sha256: 8775e6e349155fefc70b1d81394657dd1f2b85865125f7cf8d235c93dd8add89 + size: 419 + original: + hackage: env-guard-0.2@sha256:4251503bde7549e267bd307f4b293c8c0ac48c6585968108e3e3fc5a3cfbb179,1312 +- completed: + hackage: text-display-0.0.5.2@sha256:6e6a5bf1c83dfa6c34692ed5d8ea87f1bd385984309b42c302f2156f4d82477b,2670 + pantry-tree: + sha256: e84ac3f5fdc4d6e1c544174735beb80474cf7d7b849abfd1ae6184517a30c1c1 + size: 3364 + original: + hackage: text-display-0.0.5.2@sha256:6e6a5bf1c83dfa6c34692ed5d8ea87f1bd385984309b42c302f2156f4d82477b,2670 +- completed: + commit: 37ec7127fbd0f591d4539e4bf72a0badd7569181 + git: https://github.com/tbidne/algebra-simple.git + name: algebra-simple + pantry-tree: + sha256: 879b4397add8d76e697f03f4ab986d3125a72b773df88508a360db140adb459a + size: 3909 + version: '0.1' + original: + commit: 37ec7127fbd0f591d4539e4bf72a0badd7569181 + git: https://github.com/tbidne/algebra-simple.git +- completed: + commit: b7ca541cfdd8564bcebe5d38456fe7abf77885b8 + git: https://github.com/tbidne/bounds.git + name: bounds + pantry-tree: + sha256: 809a408e9b84404268e9da1a5ea8a100f683fe17ba96185ee51b01ae570c1227 + size: 833 + version: '0.1' + original: + commit: b7ca541cfdd8564bcebe5d38456fe7abf77885b8 + git: https://github.com/tbidne/bounds.git +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: concurrent-effectful + pantry-tree: + sha256: e0a8eab7981bc015ee6a42b91c4f46c10953eb7727a511ca51584936daf691c5 + size: 283 + subdir: lib/concurrent-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/concurrent-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: fs-effectful + pantry-tree: + sha256: 88384175a7b78c88695f3bb9b2538f2fb522bd7d0934a5aeec5d2f72bb5f8a55 + size: 1755 + subdir: lib/fs-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/fs-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: ioref-effectful + pantry-tree: + sha256: 1668f6d0eb661880ea65cb569bbd30c24120ee7441fc7667d436c49ad781ac80 + size: 273 + subdir: lib/ioref-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/ioref-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: logger-effectful + pantry-tree: + sha256: d1145dfcc8ae426bd98a8de704c5ca2d5d6255f2a1d056f948c9514699cf331c + size: 337 + subdir: lib/logger-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/logger-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: logger-ns-effectful + pantry-tree: + sha256: b73f95d7b00eff5fd46ac80cd7e26579da43db3dba8921c6eab042144de38be9 + size: 484 + subdir: lib/logger-ns-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/logger-ns-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: optparse-effectful + pantry-tree: + sha256: b41ac558875dfb4bc768b188a572c1b440f41339da740993108c2066450ddf18 + size: 424 + subdir: lib/optparse-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/optparse-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: terminal-effectful + pantry-tree: + sha256: 699c92372b660b9a0cc0f4aad1d82355cb6b93791d768a0f44a84b83c6a598c2 + size: 353 + subdir: lib/terminal-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/terminal-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: time-effectful + pantry-tree: + sha256: 965121237e5905cc52b5e1a7050006e0f6373aa7bc3a95d98b99bc09a4432128 + size: 539 + subdir: lib/time-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/time-effectful +- completed: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + name: typed-process-dynamic-effectful + pantry-tree: + sha256: e25b2d01d76e8d0caf028088a70d0c6379323700e57b1cd15683813e0f919629 + size: 299 + subdir: lib/typed-process-dynamic-effectful + version: '0.1' + original: + commit: 63713ede9a37754dff857900cc3fb38884c6afde + git: https://github.com/tbidne/effectful-libs.git + subdir: lib/typed-process-dynamic-effectful +- completed: + commit: e28b28ae3bc90a0336abf69eff28369b790f4e13 + git: https://github.com/tbidne/exception-utils.git + name: exception-utils + pantry-tree: + sha256: 7f2b5295921647e923acf2a01756b3e37b5aef3e0ae4c265f6c2815cde0e76cb + size: 1032 + version: '0.1' + original: + commit: e28b28ae3bc90a0336abf69eff28369b790f4e13 + git: https://github.com/tbidne/exception-utils.git +- completed: + commit: e2273c91c411e1fe12347524065855ba8e34a481 + git: https://github.com/tbidne/fs-utils.git + name: fs-utils + pantry-tree: + sha256: ce9b6359d3c0c81bbbadda6eb6890eb3e6b52a93b27c54767f8a8f017caaac47 + size: 1103 + version: '0.1' + original: + commit: e2273c91c411e1fe12347524065855ba8e34a481 + git: https://github.com/tbidne/fs-utils.git +- completed: + commit: 6bd6c1208bcda9f5d5ecb7ff45fafb91929cdea8 + git: https://github.com/tbidne/relative-time.git + name: relative-time + pantry-tree: + sha256: 2a8b0d0b5e1185265d717d0d88e2ab0a7358db7bf27542411561e8d9a815e718 + size: 899 + version: '0.1' + original: + commit: 6bd6c1208bcda9f5d5ecb7ff45fafb91929cdea8 + git: https://github.com/tbidne/relative-time.git +- completed: + commit: a39c02ec6a5a9c4b551baffafd75f26be74dd457 + git: https://github.com/tbidne/smart-math.git + name: smart-math + pantry-tree: + sha256: a1e0b92a964ef0f9b502abc2259374cb2b960a11e6911ec12471d2a9d4f127b7 + size: 6200 + version: '0.1' + original: + commit: a39c02ec6a5a9c4b551baffafd75f26be74dd457 + git: https://github.com/tbidne/smart-math.git +snapshots: +- completed: + sha256: 6a2ad7906e1cbbd2e827d5218a5b2fb2d7a5a08366f4575ca992123ef0cd9fe1 + size: 653401 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/2/9.yaml + original: nightly-2025-02-09