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

fix(test): failing yaml conversion #20

Merged
merged 4 commits into from
May 20, 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
95 changes: 94 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [master]
jobs:
checks:
name: "Run Nix checks"
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -25,5 +26,97 @@ jobs:
- name: Run Nix checks
run: nix flake check

- name: Build with Nix (runs tests)
default-ghc:
name: "Build & test with Nix (default unstable GHC)"
needs: [checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27

- name: Enable cache for Nix
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build default package with Nix
run: nix build

ghc-94:
name: "Build & test with Nix (GHC 9.4)"
needs: [checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27

- name: Enable cache for Nix
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build package with Nix (GHC 9.4)
run: nix build ".#richenv-ghc94"

ghc-96:
name: "Build & test with Nix (GHC 9.6)"
needs: [checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27

- name: Enable cache for Nix
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build package with Nix (GHC 9.6)
run: nix build ".#richenv-ghc96"

ghc-98:
name: "Build & test with Nix (GHC 9.8)"
needs: [checks]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v27

- name: Enable cache for Nix
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build package with Nix (GHC 9.8)
run: nix build ".#richenv-ghc98"

# ghc-910:
# name: "Build & test with Nix (GHC 9.10)"
# needs: [checks]
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4

# - name: Install Nix
# uses: cachix/install-nix-action@v27

# - name: Enable cache for Nix
# uses: DeterminateSystems/magic-nix-cache-action@v2

# - name: Build package with Nix (GHC 9.10)
# run: nix build ".#richenv-ghc910"
134 changes: 134 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Haskell's Dangerous Functions
# For a how-to-use and the latest version of this file go to:
# https://github.com/NorfairKing/haskell-dangerous-functions/

- ignore: { name: "Use unless" }
- ignore: { name: "Use tuple-section" }

- functions:
- {name: unsafeDupablePerformIO, within: []} # Unsafe
- {name: unsafeInterleaveIO, within: []} # Unsafe
- {name: unsafeFixIO, within: []} # Unsafe
- {name: unsafePerformIO, within: []} # Unsafe

# _VERY_ hard to get right, use the async library instead.
# See also https://github.com/informatikr/hedis/issues/165
- {name: forkIO, within: []}
# Mostly impossible to get right, rethink what you're doing entirely.
# See also https://www.reddit.com/r/haskell/comments/jsap9r/how_dangerous_is_forkprocess/
- {name: forkProcess, within: []}

- {name: undefined, within: []} # Purposely fails. Deal with errors appropriately instead.
- {name: throw, within: []} # Don't throw from pure code, use throwIO instead.
- {name: Prelude.error, within: []}

- {name: Data.List.head, within: []} # Partial, use `listToMaybe` instead.
- {name: Data.List.tail, within: []} # Partial
- {name: Data.List.init, within: []} # Partial
- {name: Data.List.last, within: []} # Partial
- {name: 'Data.List.!!', within: []} # Partial
- {name: Data.List.genericIndex, within: []} # Partial
- {name: Data.List.genericLength, within: []}

# Same, but for Data.Text
- {name: Data.Text.head, within: []}
- {name: Data.Text.tail, within: []}
- {name: Data.Text.init, within: []}
- {name: Data.Text.last, within: []}

- {name: minimum, within: []} # Partial
- {name: minimumBy, within: []} # Partial
- {name: maximum, within: []} # Partial
- {name: maximumBy, within: []} # Partial

# Same, but for Data.Text
- {name: Data.Text.maximum, within: []}
- {name: Data.Text.minimum, within: []}

- {name: GHC.Enum.pred, within: []} # Partial
- {name: GHC.Enum.succ, within: []} # Partial
- {name: GHC.Enum.toEnum, within: []} # Partial
- {name: GHC.Enum.fromEnum, within: []} # Does not do what you think it does.
- {name: GHC.Enum.enumFrom, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromThen, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromTo, within: []} # Does not do what you think it does, depending on the type.
- {name: GHC.Enum.enumFromThenTo, within: []} # Does not do what you think it does, depending on the type.

- {name: unless, within: []} # Really confusing, use 'when' instead.
- {name: either, within: []} # Really confusing, just use a case-match.

- {name: nub, within: []} # O(n^2)

- {name: Data.Foldable.foldl, within: []} # Lazy accumulator. Use foldl' instead.
- {name: Data.Foldable.foldMap, within: []} # Lazy accumulator. Use foldMap' instead.
- {name: Data.Foldable.sum, within: []} # Lazy accumulator
- {name: Data.Foldable.product, within: []} # Lazy accumulator

# Functions involving division
- {name: Prelude.quot, within: []} # Partial, see https://github.com/NorfairKing/haskell-WAT#num-int
- {name: Prelude.div, within: []}
- {name: Prelude.rem, within: []}
- {name: Prelude.mod, within: []}
- {name: Prelude.quotRem, within: []}
- {name: Prelude.divMod, within: []}

# Does unexpected things, see
# https://github.com/NorfairKing/haskell-WAT#real-double
- {name: realToFrac, within: []}

# Constructs rationals, which is either wrong or a bad idea.
- {name: 'Data.Ratio.%', within: []}

# Don't use string for command-line output.
- {name: System.IO.putChar, within: []}
- {name: System.IO.putStr, within: []}
- {name: System.IO.putStrLn, within: []}
- {name: System.IO.print, within: []}

# Don't use string for command-line input either.
- {name: System.IO.getChar, within: []}
- {name: System.IO.getLine, within: []}
- {name: System.IO.getContents, within: []} # Does lazy IO.
- {name: System.IO.interact, within: []}
- {name: System.IO.readIO, within: []}
- {name: System.IO.readLn, within: []}

# Don't use strings to interact with files
- {name: System.IO.readFile, within: []}
- {name: System.IO.writeFile, within: []}
- {name: System.IO.appendFile, within: []}

# Can succeed in dev, but fail in prod, because of encoding guessing
# It's also Lazy IO.
# See https://www.snoyman.com/blog/2016/12/beware-of-readfile/ for more info.
- {name: Data.Text.IO.readFile, within: []}
- {name: Data.Text.IO.Lazy.readFile, within: []}

- {name: Data.Text.Encoding.decodeUtf8, within: []} # Throws on invalid UTF8

- {name: fromJust, within: [], message: 'Partial'} # Partial

# Does silent truncation:
# > fromIntegral (300 :: Word) :: Word8
# 44
- {name: fromIntegral, within: []}
- {name: fromInteger, within: []}


- {name: 'read', within: []} # Partial, use `Text.Read.readMaybe` instead.

# Deprecated, use `pure` instead.
# See https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
- {name: 'return', within: []}

- modules:
- { name: Control.Lens, within: [] }

- extensions:
- { name: DeriveAnyClass, within: [] } # Dangerous

- { name: DuplicateRecordFields, within: [] }

- { name: NamedFieldPuns, within: [] }
- { name: TupleSections, within: [] }
- { name: OverloadedLabels, within: [] }
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for richenv

## 0.1.0.2 -- 2024-05-20

* test: switch dependency for YAML parsing from `yaml` to `HsYAML`.

## 0.1.0.1 -- 2023-09-25

* Fix changelog.
Expand Down
12 changes: 6 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{ mkDerivation, aeson, base, bytestring, hspec, hspec-discover, lib
, QuickCheck, quickcheck-instances, text, unordered-containers
, yaml
{ mkDerivation, aeson, base, bytestring, hspec, hspec-discover
, HsYAML, HsYAML-aeson, lib, QuickCheck, quickcheck-instances, text
, unordered-containers
}:
mkDerivation {
pname = "richenv";
version = "0.1.0.1";
version = "0.1.0.2";
src = ./.;
libraryHaskellDepends = [ aeson base text unordered-containers ];
testHaskellDepends = [
aeson base bytestring hspec QuickCheck quickcheck-instances text
unordered-containers yaml
aeson base bytestring hspec HsYAML HsYAML-aeson QuickCheck
quickcheck-instances text unordered-containers
];
testToolDepends = [ hspec-discover ];
homepage = "https://github.com/DavSanchez/richenv";
Expand Down
59 changes: 13 additions & 46 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading