Filter github actions to be executed
This commit is contained in:
parent
9aa1a59e1d
commit
8836cfe04a
4 changed files with 130 additions and 24 deletions
87
.github/workflows/ci.yaml
vendored
87
.github/workflows/ci.yaml
vendored
|
@ -4,25 +4,55 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
go: ${{ steps.filter.outputs.go }}
|
||||
charts: ${{ steps.filter.outputs.charts }}
|
||||
|
||||
steps:
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.14
|
||||
id: go
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- uses: dorny/paths-filter@v2.2.0
|
||||
id: filter
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
filters: |
|
||||
go:
|
||||
- '**/*.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- 'rootfs/**/*'
|
||||
charts:
|
||||
- 'charts/ingress-nginx/Chart.yaml'
|
||||
- 'charts/ingress-nginx/*'
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.go == 'true' }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set up Go 1.14
|
||||
id: go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
|
@ -63,15 +93,55 @@ jobs:
|
|||
name: docker.tar.gz
|
||||
path: docker.tar.gz
|
||||
|
||||
helm:
|
||||
name: Helm chart
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.charts == 'true' }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
./build/run-in-docker.sh ./hack/verify-chart-lint.sh
|
||||
|
||||
- name: fix permissions
|
||||
run: |
|
||||
sudo mkdir -p $HOME/.kube
|
||||
sudo chmod -R 777 $HOME/.kube
|
||||
|
||||
- name: Create Kubernetes cluster
|
||||
id: kind
|
||||
uses: engineerd/setup-kind@v0.4.0
|
||||
with:
|
||||
version: v0.8.1
|
||||
image: kindest/node:v1.18.4
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
KIND_CLUSTER_NAME: kind
|
||||
SKIP_CLUSTER_CREATION: true
|
||||
run: |
|
||||
kind get kubeconfig > $HOME/.kube/kind-config-kind
|
||||
make kind-e2e-chart-tests
|
||||
|
||||
kubernetes:
|
||||
name: Kubernetes
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
needs:
|
||||
- changes
|
||||
- build
|
||||
if: ${{ needs.changes.outputs.go == 'true' }}
|
||||
strategy:
|
||||
matrix:
|
||||
k8s: [v1.14.10, v1.15.11, v1.16.9, v1.17.5, v1.18.4]
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
|
@ -88,7 +158,6 @@ jobs:
|
|||
config: test/e2e/kind.yaml
|
||||
image: kindest/node:${{ matrix.k8s }}
|
||||
|
||||
# delete-artifact
|
||||
- uses: geekyeggo/delete-artifact@v1
|
||||
with:
|
||||
name: docker.tar.gz
|
||||
|
|
31
.github/workflows/main.yaml
vendored
31
.github/workflows/main.yaml
vendored
|
@ -7,8 +7,31 @@ on:
|
|||
|
||||
jobs:
|
||||
|
||||
docs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
go: ${{ steps.filter.outputs.go }}
|
||||
charts: ${{ steps.filter.outputs.charts }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- uses: dorny/paths-filter@v2.2.0
|
||||
id: filter
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
filters: |
|
||||
docs:
|
||||
- 'docs/**/*'
|
||||
charts:
|
||||
- 'charts/ingress-nginx/Chart.yaml'
|
||||
|
||||
docs:
|
||||
name: Update Documentation
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.docs == 'true' }}
|
||||
steps:
|
||||
- name: Checkout master
|
||||
uses: actions/checkout@v1
|
||||
|
@ -19,8 +42,12 @@ jobs:
|
|||
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
||||
|
||||
chart:
|
||||
needs: docs
|
||||
name: Release Chart
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- changes
|
||||
if: ${{ needs.changes.outputs.charts == 'true' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout master
|
||||
uses: actions/checkout@v1
|
||||
|
|
|
@ -36,20 +36,31 @@ fi
|
|||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
export K8S_VERSION=${K8S_VERSION:-v1.18.4@sha256:d8ff5fc405fc679dd3dd0cccc01543ba4942ed90823817d2e9e2c474a5343c4f}
|
||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
||||
|
||||
KIND_CLUSTER_NAME="ingress-nginx-dev"
|
||||
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}"
|
||||
|
||||
echo "[dev-env] creating Kubernetes cluster with kind"
|
||||
export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}"
|
||||
kind create cluster \
|
||||
# Disable execution if running as a Prow job
|
||||
if [[ ! -z ${PROW_JOB_ID:-} ]]; then
|
||||
echo "skipping execution..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${SKIP_CLUSTER_CREATION:-false}" = "false" ]; then
|
||||
echo "[dev-env] creating Kubernetes cluster with kind"
|
||||
|
||||
export K8S_VERSION=${K8S_VERSION:-v1.18.4@sha256:d8ff5fc405fc679dd3dd0cccc01543ba4942ed90823817d2e9e2c474a5343c4f}
|
||||
|
||||
kind create cluster \
|
||||
--verbosity=${KIND_LOG_LEVEL} \
|
||||
--name ${KIND_CLUSTER_NAME} \
|
||||
--config "${DIR}/kind.yaml" \
|
||||
--config ${DIR}/kind.yaml \
|
||||
--retain \
|
||||
--image "kindest/node:${K8S_VERSION}"
|
||||
|
||||
echo "Kubernetes cluster:"
|
||||
kubectl get nodes -o wide
|
||||
echo "Kubernetes cluster:"
|
||||
kubectl get nodes -o wide
|
||||
fi
|
||||
|
||||
echo "[dev-env] running helm chart e2e tests..."
|
||||
docker run --rm --interactive --network host \
|
||||
|
|
|
@ -39,8 +39,7 @@ trap cleanup EXIT
|
|||
|
||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
||||
|
||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
||||
|
||||
# Disable execution if running as a Prow job
|
||||
if [[ ! -z ${PROW_JOB_ID:-} ]]; then
|
||||
echo "skipping execution..."
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue