|
2 | 2 | name: Test / Release
|
3 | 3 | on: [push, pull_request]
|
4 | 4 | jobs:
|
| 5 | + setmatrix: |
| 6 | + name: Set Configuration Matrix |
| 7 | + runs-on: ubuntu-latest |
| 8 | + outputs: |
| 9 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 10 | + v1_matrix: ${{ steps.set-matrix.outputs.v1_matrix }} |
| 11 | + steps: |
| 12 | + - name: checkout |
| 13 | + uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + fetch-depth: '5' |
| 16 | + - id: set-matrix |
| 17 | + name: setconfigmatrix |
| 18 | + run: | |
| 19 | + full_json=$(cat ./.github/config/kind-matrix-config.json | jq -rc .) |
| 20 | + v1_json=$(cat ./.github/config/kind-matrix-config.json | jq -rc '.configuration |= map(select(.crd_version == "v1"))') |
| 21 | + echo "::set-output name=matrix::${full_json}" |
| 22 | + echo "::set-output name=v1_matrix::${v1_json}" |
5 | 23 | tests:
|
6 | 24 | runs-on: ubuntu-20.04
|
7 | 25 | name: Tests
|
@@ -31,58 +49,102 @@ jobs:
|
31 | 49 | fail_ci_if_error: true # optional (default = false)
|
32 | 50 | e2etests:
|
33 | 51 | runs-on: ubuntu-20.04
|
| 52 | + needs: ['setmatrix'] |
34 | 53 | strategy:
|
35 | 54 | fail-fast: false
|
36 |
| - matrix: |
37 |
| - configuration: |
38 |
| - - {version: '1.14', kind: "v0.11.1", image: 'kindest/node:v1.14.10@sha256:f8a66ef82822ab4f7569e91a5bccaf27bceee135c1457c512e54de8c6f7219f8', crd_version: 'v1beta1' } |
39 |
| - - {version: '1.15', kind: "v0.11.1", image: 'kindest/node:v1.15.12@sha256:b920920e1eda689d9936dfcf7332701e80be12566999152626b2c9d730397a95', crd_version: 'v1beta1' } |
40 |
| - - {version: '1.16', kind: "v0.11.1", image: 'kindest/node:v1.16.15@sha256:83067ed51bf2a3395b24687094e283a7c7c865ccc12a8b1d7aa673ba0c5e8861', crd_version: 'v1' } |
41 |
| - - {version: '1.17', kind: "v0.11.1", image: 'kindest/node:v1.17.17@sha256:66f1d0d91a88b8a001811e2f1054af60eef3b669a9a74f9b6db871f2f1eeed00', crd_version: 'v1' } |
42 |
| - - {version: '1.18', kind: "v0.11.1", image: 'kindest/node:v1.18.19@sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c', crd_version: 'v1' } |
43 |
| - - {version: '1.19', kind: "v0.11.1", image: 'kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729', crd_version: 'v1' } |
44 |
| - - {version: '1.20', kind: "v0.11.1", image: 'kindest/node:v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9', crd_version: 'v1' } |
45 |
| - - {version: '1.21', kind: "v0.11.1", image: 'kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6', crd_version: 'v1' } |
46 |
| - - {version: '1.22', kind: "v0.11.1", image: 'kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047', crd_version: 'v1' } |
47 |
| - - {version: '1.23', kind: "v0.11.1", image: 'kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac', crd_version: 'v1' } |
48 |
| - name: k8s ${{ matrix.configuration.version }} |
| 55 | + matrix: ${{fromJson(needs.setmatrix.outputs.matrix)}} |
| 56 | + name: e2e test k8s ${{ matrix.configuration.version }} |
49 | 57 | steps:
|
50 |
| - - name: checkout |
| 58 | + - name: Checkout |
51 | 59 | uses: actions/checkout@v3
|
52 | 60 | with:
|
53 | 61 | fetch-depth: '5'
|
54 |
| - - name: build local Image |
| 62 | + |
| 63 | + - name: Build local image |
55 | 64 | run: docker build -t metacontrollerio/metacontroller:dev .
|
56 |
| - - name: setup kind |
| 65 | + |
| 66 | + - name: Setup kind |
57 | 67 |
|
58 | 68 | with:
|
59 | 69 | version: ${{ matrix.configuration.kind }}
|
60 | 70 | node_image: ${{ matrix.configuration.image }}
|
61 | 71 | cluster_name: kind
|
62 | 72 | wait: 120s
|
| 73 | + |
63 | 74 | - name: Load metacontroller image
|
64 | 75 | run: |
|
65 | 76 | kind load docker-image metacontrollerio/metacontroller:dev
|
66 |
| - - name: Replace CRD mnifests to v1beta1 |
| 77 | +
|
| 78 | + - name: Replace CRD manifests to v1beta1 |
67 | 79 | if: ${{ matrix.configuration.crd_version == 'v1beta1' }}
|
68 | 80 | run: |
|
69 | 81 | sed -i 's/crds-v1/crds-v1beta1/' manifests/production/kustomization.yaml
|
70 | 82 | for file in examples/**/*.yaml; do sed -i 's/apiextensions.k8s.io\/v1/apiextensions.k8s.io\/v1beta1/g' $file; done
|
| 83 | +
|
71 | 84 | - name: Apply metacontroller manifests
|
72 | 85 | run: |
|
73 | 86 | kubectl apply -k manifests/dev
|
74 | 87 | sleep 60s
|
75 | 88 | kubectl get pods -n metacontroller
|
| 89 | +
|
76 | 90 | - name: Run e2e tests
|
77 | 91 | timeout-minutes: 30
|
78 | 92 | run: |
|
79 | 93 | cd examples
|
80 | 94 | ./test.sh --crd_version ${{ matrix.configuration.crd_version }}
|
| 95 | +
|
| 96 | + helmtests: |
| 97 | + runs-on: ubuntu-20.04 |
| 98 | + needs: ['setmatrix'] |
| 99 | + strategy: |
| 100 | + fail-fast: false |
| 101 | + matrix: ${{fromJson(needs.setmatrix.outputs.v1_matrix)}} |
| 102 | + name: helm test k8s ${{ matrix.configuration.version }} |
| 103 | + steps: |
| 104 | + - name: Checkout |
| 105 | + uses: actions/checkout@v3 |
| 106 | + with: |
| 107 | + fetch-depth: 0 |
| 108 | + |
| 109 | + - name: Set up Helm |
| 110 | + uses: azure/setup-helm@v1 |
| 111 | + with: |
| 112 | + version: v3.8.1 |
| 113 | + |
| 114 | + - uses: actions/setup-python@v2 |
| 115 | + with: |
| 116 | + python-version: 3.7 |
| 117 | + |
| 118 | + - name: Set up chart-testing |
| 119 | + |
| 120 | + |
| 121 | + - name: Setup kind |
| 122 | + |
| 123 | + with: |
| 124 | + version: ${{ matrix.configuration.kind }} |
| 125 | + node_image: ${{ matrix.configuration.image }} |
| 126 | + cluster_name: kind |
| 127 | + wait: 120s |
| 128 | + |
| 129 | + - name: Run chart-testing (lint) |
| 130 | + run: | |
| 131 | + ct lint --chart-dirs deploy/helm \ |
| 132 | + --chart-yaml-schema '.github/config/chart-testing/etc/chart_schema.yaml' \ |
| 133 | + --lint-conf '.github/config/chart-testing/etc/lintconf.yaml' \ |
| 134 | + --validate-maintainers=false \ |
| 135 | + --check-version-increment=false \ |
| 136 | + --target-branch ${{ github.event.repository.default_branch }} |
| 137 | +
|
| 138 | + - name: Run chart-testing (install) |
| 139 | + run: | |
| 140 | + ct install --chart-dirs deploy/helm \ |
| 141 | + --target-branch ${{ github.event.repository.default_branch }} |
| 142 | +
|
81 | 143 | release:
|
82 | 144 | if: (github.ref == 'refs/heads/master') && (github.repository_owner == 'metacontroller')
|
83 | 145 | name: Release - Create tag
|
84 | 146 | runs-on: ubuntu-20.04
|
85 |
| - needs: ['tests', 'e2etests'] |
| 147 | + needs: ['tests', 'e2etests', 'helmtests'] |
86 | 148 | steps:
|
87 | 149 | - name: Checkout
|
88 | 150 | uses: actions/checkout@v1
|
|
0 commit comments