feat: 1.31 (#55) #382
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Modules | |
on: | |
push: | |
branches: | |
- main | |
- "release/**" | |
paths: | |
- "modules/*/*/base/**" | |
- "test/**" | |
pull_request: | |
permissions: {} | |
concurrency: | |
group: ci-tests-${{ github.ref }} | |
cancel-in-progress: true # cancels obsolete running jobs | |
jobs: | |
get-changed-modules: | |
name: "Build Changed Modules List" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
matrix: ${{ steps.changed-files.outputs.all_changed_files }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Calculate file differences | |
id: changed-files | |
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6 | |
with: | |
dir_names: true | |
json: true | |
escape_json: false | |
dir_names_max_depth: 4 | |
files: | | |
modules/*/*/base/** | |
test/** | |
test-module: | |
name: "Test" | |
if: needs.get-changed-modules.outputs.any_changed == 'true' | |
needs: | |
- get-changed-modules | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
versions: | |
- kind: kindest/node:v1.32.2@sha256:f226345927d7e348497136874b6d207e0b32cc52154ad8323129352923a3142f | |
kubectl: "v1.32.2" | |
- kind: kindest/node:v1.31.6@sha256:28b7cbb993dfe093c76641a0c95807637213c9109b761f1d422c2400e22b8e87 | |
kubectl: "v1.31.6" | |
module: ${{ fromJSON(needs.get-changed-modules.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Kustomize Build | |
run: | | |
mkdir ci | |
kustomize build ${{ matrix.module }} > ci/rendered.yaml | |
- name: Create k8s Kind Cluster for Cilium | |
if: matrix.module == 'modules/cni/cilium/base' | |
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 | |
with: | |
version: v0.27.0 | |
kubectl_version: "${{ matrix.versions.kubectl }}" | |
node_image: "${{ matrix.versions.kind }}" | |
config: .github/workflows/kind-configs/no-cni.yaml | |
wait: 10s | |
- name: Create k8s Kind Cluster | |
if: matrix.module != 'modules/cni/cilium/base' | |
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 | |
with: | |
version: v0.27.0 | |
kubectl_version: "${{ matrix.versions.kubectl }}" | |
node_image: "${{ matrix.versions.kind }}" | |
config: .github/workflows/kind-configs/default.yaml | |
wait: 60s | |
- name: Install module | |
run: | | |
kubectl cluster-info | |
CRDS=$(yq eval-all 'select(.kind == "CustomResourceDefinition")' ci/rendered.yaml) | |
NON_CRDS=$(yq eval-all 'select(.kind != "CustomResourceDefinition")' ci/rendered.yaml) | |
if [ -n "${CRDS}" ] ; then | |
echo "Apply CRDs.." | |
kubectl create -f - <<< ${CRDS} | |
echo "Wait until all CRDs are available.." | |
kubectl wait --for condition=established crd $(yq eval-all 'select(.kind == "CustomResourceDefinition") | [ .metadata.name ] | join(" ")' ci/rendered.yaml ) | |
fi | |
echo "Apply other resources.." | |
kubectl create -f - <<< ${NON_CRDS} | |
- name: Test - Rollout success | |
run: | | |
AWAITABLES="Deployment StatefulSet DaemonSet" | |
for KIND in ${AWAITABLES} ; do | |
NAMES=$(yq eval-all "select(.kind == \"${KIND}\") | [ .metadata.name ] | join(\" \")" ci/rendered.yaml) | |
for NAME in $NAMES ; do | |
kubectl -n $(yq eval-all "select(.kind == \"${KIND}\" and .metadata.name == \"${NAME}\") | .metadata.namespace" ci/rendered.yaml ) rollout status "${KIND}" --timeout 10m "${NAME}" | |
done | |
done | |
- name: Custom test script | |
if: startsWith( 'test/', ${{matrix.module}} ) | |
run: | | |
[ ! -x ${{ matrix.module }}/test.sh ] && exit 0 | |
${{ matrix.module }}/test.sh |