Skip to content

Update action workflow (#55) #8

Update action workflow (#55)

Update action workflow (#55) #8

Workflow file for this run

name: Pre-commit checks
on:
pull_request:
branches:
- master
- ack-spark-operator3.0
push:
branches:
- master
- ack-spark-operator3.0
jobs:
build-api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: The API documentation hasn't changed
run: |
make build-api-docs
if ! git diff --quiet -- docs/api-docs.md; then
echo "Need to re-run 'make build-api-docs' and commit the changes"
git diff -- docs/api-docs.md;
false
fi
build-sparkctl:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: build sparkctl
run: |
make all
build-spark-operator:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run gofmt check
run: make fmt-check
- name: Run static analysis
run: make static-analysis
- name: Run unit tests
run: make unit-test
- name: Build Spark-Operator Docker Image
run: |
docker build -t docker.io/kubeflow/spark-operator:latest .
- name: Check changes in resources used in docker file
run: |
DOCKERFILE_RESOURCES=$(cat Dockerfile | grep -P -o "COPY [a-zA-Z0-9].*? " | cut -c6-)
for resource in $DOCKERFILE_RESOURCES; do
# If the resource is different
if ! git diff --quiet origin/master -- $resource; then
## And the appVersion hasn't been updated
if ! git diff origin/master -- charts/spark-operator-chart/Chart.yaml | grep +appVersion; then
echo "resource used in docker.io/kubeflow/spark-operator has changed in $resource, need to update the appVersion in charts/spark-operator-chart/Chart.yaml"
git diff origin/master -- $resource;
echo "failing the build... " && false
fi
fi
done
build-helm-chart:
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.14.3
- name: Produce the helm documentation
run: |
make helm-docs
if ! git diff --quiet -- charts/spark-operator-chart/README.md; then
echo "Need to re-run 'make helm-docs' and commit the changes"
false
fi
- name: Set up chart-testing
uses: helm/[email protected]
- name: Print chart-testing version information
run: ct version
- name: Run chart-testing (lint)
run: ct lint
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Detect CRDs drift between chart and manifest
run: make detect-crds-drift
- name: setup minikube
uses: manusa/[email protected]
with:
minikube version: v1.32.0
kubernetes version: v1.28.8
start args: --memory 6g --cpus=2 --addons ingress
github token: ${{ inputs.github-token }}
- name: Run chart-testing (install)
run: |
docker build -t docker.io/kubeflow/spark-operator:local .
minikube image load docker.io/kubeflow/spark-operator:local
ct install
integration-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: setup minikube
uses: manusa/[email protected]
with:
minikube version: v1.32.0
kubernetes version: v1.28.8
start args: --memory 6g --cpus=2 --addons ingress
github token: ${{ inputs.github-token }}
- name: Build local spark-operator docker image for minikube testing
run: |
docker build -t docker.io/kubeflow/spark-operator:local .
minikube image load docker.io/kubeflow/spark-operator:local
# The integration tests are currently broken see: https://github.com/kubeflow/spark-operator/issues/1416
# - name: Run chart-testing (integration test)
# run: make integration-test
- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15