CI IT #262
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: CI IT | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 5 * * 1,3,5' | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Load Matrix' | |
id: matrix | |
shell: bash | |
run: | | |
MATRIX=$(jq -c . .github/workflows/k8s-versions.json) | |
echo "MATRIX=$MATRIX" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.matrix.outputs.MATRIX }} | |
k8s-it: | |
runs-on: ubuntu-latest | |
needs: [ prepare ] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-m2it-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-m2- | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'liberica' | |
- name: Install kubectl | |
uses: azure/setup-kubectl@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: 'Install minikube ${{ matrix.patch && matrix.patch || matrix.k8s_version }}' | |
shell: bash | |
run: | | |
MINIKUBE_VERSION="v1.32.0" | |
curl -LO "https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64" | |
sudo install minikube-linux-amd64 /usr/local/bin/minikube | |
minikube start "--kubernetes-version=${{ matrix.patch && matrix.patch || matrix.k8s_version }}" | |
- name: 'Prepare docker hub pull secrets' | |
shell: bash | |
env: | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
run: | | |
kubectl create secret docker-registry docker-hub-pull-secret \ | |
--docker-server=registry-1.docker.io \ | |
--docker-username="$DOCKER_HUB_USERNAME" \ | |
--docker-password="$DOCKER_HUB_PASSWORD" \ | |
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "docker-hub-pull-secret"}]}' | |
# build | |
- name: Build | |
run: | | |
./mvnw install -am -pl spring-cloud-deployer-kubernetes,spring-cloud-deployer-spi-test-app -DskipTests -T 1C | |
./mvnw spring-boot:build-image -pl spring-cloud-deployer-spi-test-app | |
minikube image load springcloud/spring-cloud-deployer-spi-test-app:latest | |
./mvnw -B -Pfailsafe verify -pl spring-cloud-deployer-kubernetes | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: ${{ success() || failure() }} | |
with: | |
name: "Integration Test - Report for ${{ matrix.k8s_version }}" | |
path: '**/failsafe-reports/*IT.xml' | |
reporter: java-junit | |
list-tests: 'failed' | |
# clean m2 cache | |
- name: Clean cache | |
run: | | |
find ~/.m2/repository -type d -name '*SNAPSHOT' | xargs rm -fr |