Skip to content

fix: Upgrade to LTS-19.18 #124

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

Merged
merged 5 commits into from
Feb 6, 2023
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
64 changes: 34 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
name: CI
name: Build & test

on:
pull_request:
push:
branches: [master]
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:

# Needed for the add-path command
- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV

- uses: actions/checkout@v1

- uses: mstksg/setup-stack@v1

- uses: actions/cache@v1
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-stack-
- name: Checkout code
uses: actions/checkout@v2

- uses: haskell/actions/setup@v2
with:
ghc-version: "9.0.2" # Exact version of ghc to use
# cabal-version: 'latest'. Omitted, but defaults to 'latest'
enable-stack: true
stack-version: "2.9.3"

# Attempt to load cached dependencies
- name: Cache Stack dependencies
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}

- name: Build and test
run: |
stack build --test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps --no-haddock-hyperlink-source --fast

- uses: actions/cache@v1
name: Cache .stack-work
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-stack-work-

- name: Compile with Stack
run: stack test --fast
# Save cached dependencies
- name: Cache Stack dependencies
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml') }}
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Package

on:
push:
branches:
- main

env:
HACKAGE_USERNAME: ${{ secrets.HACKAGE_USERNAME }}
HACKAGE_PASSWORD: ${{ secrets.HACKAGE_PASSWORD }}

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Stack
uses: actions/setup-haskell@v1
with:
ghc-version: 8.10.2
stack-version: 2.5.1

- name: Bump version field
run: |
if grep -q "feat" <<< "$GITHUB_REF"; then
echo "feat: bumping minor version"
stack exec bump-version minor package.yaml
elif grep -q "fix" <<< "$GITHUB_REF"; then
echo "fix: bumping patch version"
stack exec bump-version patch package.yaml
elif grep -q "breaking" <<< "$GITHUB_REF"; then
echo "breaking: bumping major version"
stack exec bump-version major package.yaml
else
echo "no version bump required"
fi

- name: Publish to Hackage
run: |
echo "publishing to hackage"
echo "username: $HACKAGE_USERNAME"
echo "password: $HACKAGE_PASSWORD"
echo "$HACKAGE_PASSWORD" | stack publish --username "$HACKAGE_USERNAME" --password-stdin

- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
force: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions aws-lambda-haskell-runtime.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.1.
--
-- see: https://github.com/sol/hpack

Expand All @@ -13,7 +13,7 @@ homepage: https://github.com/theam/aws-lambda-haskell-runtime#readme
bug-reports: https://github.com/theam/aws-lambda-haskell-runtime/issues
author: Nikita Tchayka
maintainer: [email protected]
copyright: 2021 The Agile Monkeys SL
copyright: 2023 The Agile Monkeys SL
license: Apache-2.0
license-file: LICENSE
build-type: Simple
Expand Down Expand Up @@ -58,7 +58,7 @@ library
QuasiQuotes
ghc-options: -Wall -optP-Wno-nonportable-include-path -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat -Widentities -Wredundant-constraints -Wmissing-export-lists -Wpartial-fields -fhide-source-paths -freverse-errors
build-depends:
aeson
aeson >2
, base >=4.7 && <5
, bytestring
, case-insensitive
Expand Down
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ github: "theam/aws-lambda-haskell-runtime"
license: Apache-2.0
author: Nikita Tchayka
maintainer: [email protected]
copyright: 2021 The Agile Monkeys SL
copyright: 2023 The Agile Monkeys SL

extra-source-files:
- README.md
Expand All @@ -18,7 +18,7 @@ dependencies:

library:
dependencies:
- aeson
- aeson > 2
- bytestring
- http-client
- http-types
Expand Down
7 changes: 4 additions & 3 deletions src/Aws/Lambda/Runtime/ALB/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Data.Aeson
)
import Data.Aeson.Types (Parser)
import qualified Data.Aeson.Types as T
import qualified Data.Aeson.Key as K
import qualified Data.CaseInsensitive as CI
import Data.HashMap.Strict (HashMap)
import Data.Text (Text)
Expand Down Expand Up @@ -59,7 +60,7 @@ instance FromJSON body => FromJSON (ALBRequest body) where
parseJSON = parseALBRequest parseObjectFromStringField

-- We need this because API Gateway is going to send us the payload as a JSON string
parseObjectFromStringField :: FromJSON a => Object -> Text -> Parser (Maybe a)
parseObjectFromStringField :: FromJSON a => Object -> T.Key -> Parser (Maybe a)
parseObjectFromStringField obj fieldName = do
fieldContents <- obj .: fieldName
case fieldContents of
Expand All @@ -70,7 +71,7 @@ parseObjectFromStringField obj fieldName = do
Null -> pure Nothing
other -> T.typeMismatch "String or Null" other

parseALBRequest :: (Object -> Text -> Parser (Maybe body)) -> Value -> Parser (ALBRequest body)
parseALBRequest :: (Object -> T.Key -> Parser (Maybe body)) -> Value -> Parser (ALBRequest body)
parseALBRequest bodyParser (Object v) =
ALBRequest
<$> v .: "path"
Expand Down Expand Up @@ -167,5 +168,5 @@ mkALBResponse code headers payload =
headerToPair :: Header -> T.Pair
headerToPair (cibyte, bstr) = k .= v
where
k = (T.decodeUtf8 . CI.original) cibyte
k = (K.fromText . T.decodeUtf8 . CI.original) cibyte
v = T.decodeUtf8 bstr
7 changes: 4 additions & 3 deletions src/Aws/Lambda/Runtime/APIGateway/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Data.Aeson
(.:?)
)
import Data.Aeson.Types (Parser)
import qualified Data.Aeson.Key as K
import qualified Data.Aeson.Types as T
import qualified Data.CaseInsensitive as CI
import Data.HashMap.Strict (HashMap)
Expand Down Expand Up @@ -70,7 +71,7 @@ instance FromJSON body => FromJSON (ApiGatewayRequest body) where
parseJSON = parseApiGatewayRequest parseObjectFromStringField

-- We need this because API Gateway is going to send us the payload as a JSON string
parseObjectFromStringField :: FromJSON a => Object -> Text -> Parser (Maybe a)
parseObjectFromStringField :: FromJSON a => Object -> T.Key -> Parser (Maybe a)
parseObjectFromStringField obj fieldName = do
fieldContents <- obj .: fieldName
case fieldContents of
Expand All @@ -81,7 +82,7 @@ parseObjectFromStringField obj fieldName = do
Null -> pure Nothing
other -> T.typeMismatch "String or Null" other

parseApiGatewayRequest :: (Object -> Text -> Parser (Maybe body)) -> Value -> Parser (ApiGatewayRequest body)
parseApiGatewayRequest :: (Object -> T.Key -> Parser (Maybe body)) -> Value -> Parser (ApiGatewayRequest body)
parseApiGatewayRequest bodyParser (Object v) =
ApiGatewayRequest
<$> v .: "resource"
Expand Down Expand Up @@ -215,5 +216,5 @@ mkApiGatewayResponse code headers payload =
headerToPair :: Header -> T.Pair
headerToPair (cibyte, bstr) = k .= v
where
k = (T.decodeUtf8 . CI.original) cibyte
k = (K.fromText . T.decodeUtf8 . CI.original) cibyte
v = T.decodeUtf8 bstr
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-16.12
resolver: lts-19.18

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
16 changes: 8 additions & 8 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ packages:
- completed:
hackage: require-0.4.2@sha256:f28dc58dd927e98a709dd926ace92704c09db34dd33a278e1d5aa22cac133984,3625
pantry-tree:
size: 718
sha256: 1fe2c5947db887175c819c3a0a55d9dcbb5823d28d0a5f588ea1db2d370bd1e1
size: 718
original:
hackage: require-0.4.2
- completed:
hackage: cheapskate-0.1.1.2@sha256:b8ae3cbb826610ea45e6840b7fde0af2c2ea6690cb311edfe9683f61c0a50d96,3072
pantry-tree:
size: 866
sha256: f3d8b45723bf9851163e50b900b5397e22dca07af70c2c6145a5aea34e3a0e49
size: 866
original:
hackage: cheapskate-0.1.1.2@sha256:b8ae3cbb826610ea45e6840b7fde0af2c2ea6690cb311edfe9683f61c0a50d96,3072
- completed:
hackage: inliterate-0.1.0@sha256:61b17ab3cef803512c264e27e463390b47af59d7d2b3a2a89bea2eac0cf84266,1853
pantry-tree:
size: 618
sha256: 2cea999a63449b913f6186c3b8b276050e7a1a7195f5e94ac94fa4007da36558
size: 618
original:
hackage: inliterate-0.1.0@sha256:61b17ab3cef803512c264e27e463390b47af59d7d2b3a2a89bea2eac0cf84266,1853
- completed:
hackage: megaparsec-7.0.5@sha256:45e1f1348fab2783646fdb4d9e6097568981a740951c7356d36d794e2baba305,3902
pantry-tree:
size: 1428
sha256: 1f8baf6e07326f8c8a2dd31de6b2860427f158b0892c52ba5fe9ffeb6cd3bf7f
size: 1428
original:
hackage: megaparsec-7.0.5@sha256:45e1f1348fab2783646fdb4d9e6097568981a740951c7356d36d794e2baba305,3902
snapshots:
- completed:
size: 532377
url: https://github.com/raw/commercialhaskell/stackage-snapshots/master/lts/16/12.yaml
sha256: f914cfa23fef85bdf895e300a8234d9d0edc2dbec67f4bc9c53f85867c50eab6
original: lts-16.12
sha256: 65b9809265860e085b4f61d4eb00d5d73e41190693620385a69cc9d9df7a901d
size: 619164
url: https://github.com/raw/commercialhaskell/stackage-snapshots/master/lts/19/18.yaml
original: lts-19.18