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 build for GHC 9.4 and enable GitHub Actions CI #104

Merged
merged 10 commits into from
Jul 4, 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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on: [push]
name: CI
jobs:
cabal:
name: Cabal / GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.5"
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.8.1.0'
- run: cabal build all --enable-tests
- run: cabal test all

stack:
name: Stack / GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ghc: "8.10.7"
yaml: "stack-8.10.7.yaml"
- ghc: "9.0.2"
yaml: "stack-9.0.2-aeson1.yaml"
- ghc: "9.0.2"
yaml: "stack-9.0.2-aeson2.yaml"
- ghc: "9.2.8"
yaml: "stack-9.2.8.yaml"
- ghc: "9.4.5"
yaml: "stack.yaml"
steps:
- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: "latest"

- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}

- name: Build
run: |
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks

- name: Test
run: |
stack test --stack-yaml ${{matrix.yaml}} --system-ghc
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Kubernetes Haskell Client

[![Stack and Cabal](https://github.com/kubernetes-client/haskell/actions/workflows/ci.yml/badge.svg)](https://github.com/kubernetes-client/haskell/actions/workflows/ci.yml)
[![Build Status](https://travis-ci.org/kubernetes-client/haskell.svg?branch=master)](https://travis-ci.org/kubernetes-client/haskell)

Haskell client for the [kubernetes](http://kubernetes.io/) API.
Expand Down
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages:
kubernetes
kubernetes-client
examples
1 change: 0 additions & 1 deletion examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dist
dist-newstyle
*.cabal
.stack-work
54 changes: 54 additions & 0 deletions examples/kubernetes-examples.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cabal-version: 1.12

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

name: kubernetes-examples
version: 0.1.0.1
synopsis: Kubernetes examples with Haskell
description: Examples to interact with Kubernetes using kubernetes-client and kubernetes-client-core
category: Examples, Kubernetes
maintainer: Shimin Guo <smguo2001@gmail.com>,
Akshay Mankar <itsakshaymankar@gmail.com>
license: Apache-2.0
license-file: LICENSE
build-type: Simple

executable in-cluster
main-is: Main.hs
other-modules:
Paths_kubernetes_examples
hs-source-dirs:
in-cluster
ghc-options: -Wall
build-depends:
base <5
, containers
, http-client
, http-types
, kubernetes-client
, kubernetes-client-core
, safe-exceptions
, stm
, text
default-language: Haskell2010

executable simple
main-is: Main.hs
other-modules:
Paths_kubernetes_examples
hs-source-dirs:
simple
ghc-options: -Wall
build-depends:
base <5
, containers
, http-client
, http-types
, kubernetes-client
, kubernetes-client-core
, safe-exceptions
, stm
, text
default-language: Haskell2010
2 changes: 1 addition & 1 deletion examples/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ executables:
ghc-options:
- -Wall
dependencies:
- base
- base < 5
- containers
- http-client
- http-types
Expand Down
36 changes: 23 additions & 13 deletions kubernetes-client/kubernetes-client.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.35.1.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -44,13 +44,15 @@ library
hs-source-dirs:
src
ghc-options: -Wall
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
aeson >=1.2 && <3
, attoparsec >=0.13
, base >=4.7 && <5.0
, base64-bytestring
, bytestring >=0.10
, connection >=0.2
, connection >=0.3
, containers >=0.5
, data-default-class >=0.1
, either >=5.0
Expand All @@ -59,16 +61,17 @@ library
, http-client >=0.5 && <0.8
, http-client-tls >=0.3
, jose-jwt >=0.8
, jsonpath >=0.1 && <0.3
, jsonpath >=0.1 && <0.4
, kubernetes-client-core ==0.4.3.0
, megaparsec ==9.*
, microlens >=0.4
, mtl >=2.2
, oidc-client >=0.4
, pem >=0.2
, safe-exceptions >=0.1.0.0
, stm >=2.4
, streaming-bytestring >=0.1 && <0.3
, text >=0.11 && <1.3
, streaming-bytestring >=0.1 && <0.4
, text >=0.11 && <3
, time >=1.8
, timerep >=2.0
, tls >=1.4.1
Expand All @@ -88,13 +91,15 @@ test-suite example
Paths_kubernetes_client
hs-source-dirs:
example
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
aeson >=1.2 && <3
, attoparsec >=0.13
, base >=4.7 && <5.0
, base64-bytestring
, bytestring >=0.10
, connection >=0.2
, connection >=0.3
, containers >=0.5
, data-default-class >=0.1
, either >=5.0
Expand All @@ -103,17 +108,18 @@ test-suite example
, http-client >=0.5 && <0.8
, http-client-tls >=0.3
, jose-jwt >=0.8
, jsonpath >=0.1 && <0.3
, jsonpath >=0.1 && <0.4
, kubernetes-client
, kubernetes-client-core ==0.4.3.0
, megaparsec ==9.*
, microlens >=0.4
, mtl >=2.2
, oidc-client >=0.4
, pem >=0.2
, safe-exceptions >=0.1.0.0
, stm >=2.4
, streaming-bytestring >=0.1 && <0.3
, text >=0.11 && <1.3
, streaming-bytestring >=0.1 && <0.4
, text >=0.11 && <3
, time >=1.8
, timerep >=2.0
, tls >=1.4.1
Expand All @@ -138,13 +144,15 @@ test-suite spec
Paths_kubernetes_client
hs-source-dirs:
test
build-tool-depends:
hspec-discover:hspec-discover
build-depends:
aeson >=1.2 && <3
, attoparsec >=0.13
, base >=4.7 && <5.0
, base64-bytestring
, bytestring >=0.10
, connection >=0.2
, connection >=0.3
, containers >=0.5
, data-default-class >=0.1
, either >=5.0
Expand All @@ -153,20 +161,22 @@ test-suite spec
, hoauth2 >=1.11 && <=3
, hspec
, hspec-attoparsec
, hspec-megaparsec
, http-client >=0.5 && <0.8
, http-client-tls >=0.3
, jose-jwt >=0.8
, jsonpath >=0.1 && <0.3
, jsonpath >=0.1 && <0.4
, kubernetes-client
, kubernetes-client-core ==0.4.3.0
, megaparsec ==9.*
, microlens >=0.4
, mtl >=2.2
, oidc-client >=0.4
, pem >=0.2
, safe-exceptions >=0.1.0.0
, stm >=2.4
, streaming-bytestring >=0.1 && <0.3
, text >=0.11 && <1.3
, streaming-bytestring >=0.1 && <0.4
, text >=0.11 && <3
, time >=1.8
, timerep >=2.0
, tls >=1.4.1
Expand Down
12 changes: 8 additions & 4 deletions kubernetes-client/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ library:
source-dirs: src
ghc-options:
- -Wall
build-tools:
- hspec-discover
tests:
spec:
main: Spec.hs
Expand All @@ -23,6 +25,7 @@ tests:
- kubernetes-client
- hspec
- hspec-attoparsec
- hspec-megaparsec
- yaml
- file-embed
example:
Expand All @@ -39,8 +42,8 @@ dependencies:
- bytestring >=0.10
- aeson >=1.2 && <3
- attoparsec >=0.13
- jsonpath >=0.1 && <0.3
- connection >=0.2
- jsonpath >=0.1 && <0.4
- connection >=0.3
- containers >= 0.5
- data-default-class >=0.1
- either >=5.0
Expand All @@ -50,14 +53,15 @@ dependencies:
- http-client-tls >=0.3
- jose-jwt >=0.8
- kubernetes-client-core ==0.4.3.0
- megaparsec >=9 && <10
- microlens >=0.4
- mtl >=2.2
- oidc-client >=0.4
- pem >=0.2
- safe-exceptions >=0.1.0.0
- stm >=2.4
- streaming-bytestring >= 0.1 && < 0.3
- text >=0.11 && <1.3
- streaming-bytestring >= 0.1 && < 0.4
- text >=0.11 && <3
- time >=1.8
- timerep >=2.0
- tls >=1.4.1
Expand Down
2 changes: 0 additions & 2 deletions kubernetes-client/src/Kubernetes/Client/Auth/GCP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ where

import Control.Concurrent.STM
import Control.Exception.Safe (Exception, throwM)
import Data.Attoparsec.Text
import Data.Either.Combinators
import Data.Function ((&))
import Data.JSONPath
Expand Down Expand Up @@ -126,7 +125,6 @@ parseGCPAuthInfo authInfo = do
Just expiryText -> Just <$> parseExpiryTime expiryText
lookupEither key = Map.lookup key authInfo
& maybeToRight (GCPAuthMissingInformation $ Text.unpack key)
parseK8sJSONPath = parseOnly (k8sJSONPath <* endOfInput)
readJSONPath key defaultPath =
maybe (Right defaultPath) parseK8sJSONPath $ Map.lookup key authInfo

Expand Down
11 changes: 8 additions & 3 deletions kubernetes-client/src/Kubernetes/Client/Auth/OIDC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ instance AuthMethod OIDCAuth where
$ setHeader req [("Authorization", "Bearer " <> (Text.encodeUtf8 token))]
& L.set rAuthTypesL []

data OIDCGetTokenException = OIDCOAuthException (OAuth2Error OAuth2TokenRequest.Errors)
| OIDCURIException URIParseError
| OIDCGetTokenException String
data OIDCGetTokenException =
#if MIN_VERSION_hoauth2(2,8,0)
OIDCOAuthException TokenRequestError
#else
OIDCOAuthException (OAuth2Error OAuth2TokenRequest.Errors)
#endif
| OIDCURIException URIParseError
| OIDCGetTokenException String
deriving Show
instance Exception OIDCGetTokenException

Expand Down
Loading