Skip to content

Commit

Permalink
Build and test all K8S versions 1.20-1.30, GHC up to 9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Jun 17, 2024
1 parent bb72266 commit 6c89286
Show file tree
Hide file tree
Showing 1,021 changed files with 3,188,318 additions and 221,224 deletions.
106 changes: 77 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,109 @@ on: [push]
name: CI
jobs:
cabal:
name: Cabal / GHC ${{ matrix.ghc }}
name: Cabal / K8S ${{ matrix.k8s_release }} / GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
# This full matrix at time of writing is 11 K8S versions * 6 compiler versions = 66,
# which is a little big for CI.
# Commented some older versions of each to make it manageable.
matrix:
k8s_release:
# - "1.20"
# - "1.21"
# - "1.22"
# - "1.23"
# - "1.24"
- "1.25"
- "1.26"
- "1.27"
- "1.28"
- "1.29"
- "1.30"
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.5"
# - "8.10.7"
# - "9.0.2"
# - "9.2.8"
- "9.4.8"
- "9.6.5"
- "9.8.2"
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
- uses: actions/checkout@v4

- 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
ghc-version: ${{ matrix.compiler.ghc }}
cabal-version: '3.10.3.0'

- uses: cachix/install-nix-action@v27

- run: |
nix run .#set-cabal-version -- "${{matrix.k8s_release}}" cabal.project
cabal build all --enable-tests
- run: |
cabal test all
stack:
name: Stack / GHC ${{ matrix.ghc }}
name: Stack / K8S ${{ matrix.k8s_release }} / GHC ${{ matrix.compiler.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
# This full matrix at time of writing is 11 K8S versions * 7 compiler versions = 77,
# which is a little big for CI.
# Commented some older versions of each to make it manageable.
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"
k8s_release:
# - "1.20"
# - "1.21"
# - "1.22"
# - "1.23"
# - "1.24"
- "1.25"
- "1.26"
- "1.27"
- "1.28"
- "1.29"
- "1.30"
compiler:
# - 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.8"
yaml: "stack-9.4.8.yaml"
- ghc: "9.6.5"
yaml: "stack-9.6.5.yaml"
- ghc: "9.8.2"
yaml: "stack.yaml"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- uses: actions/cache@v3
- uses: cachix/install-nix-action@v27

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

- name: Build
run: |
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks
nix run .#set-stack-version -- "${{matrix.k8s_release}}" "${{matrix.compiler.yaml}}"
stack build --stack-yaml ${{matrix.compiler.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks
- name: Test
run: |
stack test --stack-yaml ${{matrix.yaml}} --system-ghc
stack test --stack-yaml ${{matrix.compiler.yaml}} --system-ghc
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ cabal.sandbox.config
.stack-work/
cabal.project.local
.HTF/
swagger.json
swagger.json.unprocessed
git_push.sh
19 changes: 19 additions & 0 deletions build_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTDIR"

# This script builds kubernetes-client + kubernetes-client-core for
# all Kubernetes versions.

nix run .#set-stack-version 1.20 stack.yaml && stack build
nix run .#set-stack-version 1.21 stack.yaml && stack build
nix run .#set-stack-version 1.22 stack.yaml && stack build
nix run .#set-stack-version 1.23 stack.yaml && stack build
nix run .#set-stack-version 1.24 stack.yaml && stack build
nix run .#set-stack-version 1.25 stack.yaml && stack build
nix run .#set-stack-version 1.26 stack.yaml && stack build
nix run .#set-stack-version 1.27 stack.yaml && stack build
nix run .#set-stack-version 1.28 stack.yaml && stack build
nix run .#set-stack-version 1.29 stack.yaml && stack build
nix run .#set-stack-version 1.30 stack.yaml && stack build
9 changes: 7 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
packages:
kubernetes
kubernetes-1.21
kubernetes-client
examples
examples

source-repository-package
type: git
location: https://github.com/codedownio/haskell-oidc-client
tag: b70757b85751525cba41316ea9af132d9a43cfaf
99 changes: 99 additions & 0 deletions flake.lock

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

50 changes: 50 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.gen = {
url = "github:kubernetes-client/gen";
flake = false;
};
inputs.gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=release-24.05";

outputs = { self, flake-utils, gen, gitignore, nixpkgs }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = import nixpkgs { inherit system; };

in {
packages = rec {
generate = pkgs.writeShellScriptBin "generate-kubernetes-client-core.sh" ''
export KUBERNETES_VERSION="$1"
PACKAGE_VERSION="$2"
out="kubernetes-$KUBERNETES_VERSION"
# Generate
${pkgs.bash}/bin/bash "${gen}/openapi/haskell.sh" "$out" settings
# Fill in the package version
${pkgs.gnused}/bin/sed -i "s/^version:\s*\(.*\)/version: $PACKAGE_VERSION/" "$out/kubernetes-client-core.cabal"
# Fix a bound
${pkgs.gnused}/bin/sed -i 's/\(http-api-data >= 0.3.4 &&\) <0.6/\1 <0.7/' "$out/kubernetes-client-core.cabal"
'';

set-stack-version = pkgs.writeShellScriptBin "build-kubernetes-client.sh" ''
export KUBERNETES_VERSION="$1"
STACK_YAML="$2"
${pkgs.gnused}/bin/sed -i "s/^- kubernetes-\(1\.\)[0-9]\+/- kubernetes-$KUBERNETES_VERSION/" "$STACK_YAML"
'';

set-cabal-version = pkgs.writeShellScriptBin "build-kubernetes-client.sh" ''
export KUBERNETES_VERSION="$1"
CABAL_PROJECT="$2"
${pkgs.gnused}/bin/sed -i "s/^ kubernetes-\(1\.\)[0-9]\+/ kubernetes-$KUBERNETES_VERSION/" "$CABAL_PROJECT"
'';
};
});
}
21 changes: 21 additions & 0 deletions generate_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTDIR"

# The first argument is the Kubernetes release to use.
# The second is the package version to place in ./kubernetes-<K8S version>/kubernetes-client-core.cabal.
# The idea is to use the patch number for our own purposes, incrementing when we need to update
# the kubernetes-client-core library.

nix run .#generate -- 1.20 1.20.0
nix run .#generate -- 1.21 1.21.0
nix run .#generate -- 1.22 1.22.0
nix run .#generate -- 1.23 1.23.0
nix run .#generate -- 1.24 1.24.0
nix run .#generate -- 1.25 1.25.0
nix run .#generate -- 1.26 1.26.0
nix run .#generate -- 1.27 1.27.0
nix run .#generate -- 1.28 1.28.0
nix run .#generate -- 1.29 1.29.0
nix run .#generate -- 1.30 1.30.0
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

README.md
2 changes: 2 additions & 0 deletions kubernetes-1.20/.openapi-generator/COMMIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Requested Commit/Tag : ab7d0cb74f6ef95bdaeafd327bbdb5d54f819175
Actual Commit : ab7d0cb74f6ef95bdaeafd327bbdb5d54f819175
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.gitignore
.travis.yml
README.md
Setup.hs
git_push.sh
kubernetes-client-core.cabal
Expand Down
1 change: 1 addition & 0 deletions kubernetes-1.20/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19f91fe5110cab07889fb5816d54a140ac5072c7e6e791580eaca741a56bd203
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6c89286

Please sign in to comment.