Skip to content

Bump golang.org/x/tools from 0.1.10 to 0.27.0 #1140

Bump golang.org/x/tools from 0.1.10 to 0.27.0

Bump golang.org/x/tools from 0.1.10 to 0.27.0 #1140

name: Auto Nightly CI
env:
CLUSTER_NAME: spider
E2E_TIME_OUT: 60m
on:
schedule:
# each day
- cron: "0 20 * * *"
pull_request_target:
types:
- opened
- synchronize
- reopened
push:
branches:
- main
- release-*
workflow_dispatch:
inputs:
ref:
description: 'sha, tag, branch'
required: true
default: main
e2e_labels:
description: 'e2e labels(if not set, ginkgo will run all test, multi labels separated by commas)'
required: false
type: string
jobs:
get_ref:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.result.outputs.ref }}
e2e_labels: ${{ steps.get_ref.outputs.e2e_labels }}
unitest_enabled: ${{ steps.get_ref.outputs.unitest_enabled }}
e2e_enabled: ${{ steps.get_ref.outputs.e2e_enabled }}
steps:
- name: Check build Changes
uses: dorny/[email protected]
if: ${{ github.event_name == 'pull_request_target' }}
id: filter_pr
with:
base: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.head.sha }}
filters: |
src:
- '**/*.sh'
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'charts/'
- 'Makefile*'
- '**/Makefile*'
- name: Get Ref
id: get_ref
run: |
if ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "call by self workflow_dispatch"
echo ::set-output name=tag::${{ github.event.inputs.ref }}
echo ::set-output name=e2e_labels::${{ github.event.inputs.e2e_labels }}
echo ::set-output name=e2e_enabled::true
echo ::set-output name=unitest_enabled::true
elif ${{ github.event_name == 'push' }} ; then
echo "trigger by push"
echo ::set-output name=tag::${{ github.sha }}
echo ::set-output name=push::false
echo ::set-output name=e2e_labels::smoke
echo ::set-output name=e2e_enabled::true
# do it in another workflow
echo ::set-output name=unitest_enabled::false
elif ${{ github.event_name == 'pull_request_target' }} ; then
echo "trigger by pull_request_target"
echo ::set-output name=tag::${{ github.event.pull_request.head.sha }}
echo ::set-output name=push::false
echo ::set-output name=e2e_labels::smoke
echo ::set-output name=e2e_enabled::${{ steps.filter_pr.outputs.src }}
# do it in another workflow
echo ::set-output name=unitest_enabled::false
else
# use main sha for ci image tag
echo "trigger by schedule"
echo ::set-output name=tag::main
echo ::set-output name=push::false
echo ::set-output name=e2e_labels::smoke
echo ::set-output name=e2e_enabled::true
echo ::set-output name=unitest_enabled::true
fi
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ steps.ref.outputs.tag }}
- name: Result Ref
id: result
run: |
ref=$( git show -s --format='format:%H')
echo ::set-output name=ref::${ref}
call_unitest:
needs: get_ref
if: ${{ needs.get_ref.outputs.unitest_enabled == 'true' }}
# forbid to specify version for local workflow, GITHUB_REF Same as the caller workflow
uses: ./.github/workflows/lint-golang.yaml
with:
ref: ${{ needs.get_ref.outputs.ref }}
call_build_ci_image:
needs: [get_ref]
# get image:${{ needs.get_ref.outputs.ref }} and image-ci:${{ needs.get_ref.outputs.ref }}
uses: ./.github/workflows/build-image-ci.yaml
with:
ref: ${{ needs.get_ref.outputs.ref }}
push: false
call_test_chart:
needs: get_ref
# forbid to specify version for local workflow, GITHUB_REF Same as the caller workflow
uses: ./.github/workflows/call-lint-chart.yaml
with:
ref: ${{ needs.get_ref.outputs.ref }}
call_release_chart:
needs: [call_test_chart, get_ref]
uses: ./.github/workflows/call-release-chart.yaml
with:
ref: ${{ needs.get_ref.outputs.ref }}
submit: false
call_e2e_test_smoke:
runs-on: ubuntu-latest
needs: [call_build_ci_image, get_ref, call_release_chart]
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }}
steps:
- name: Prepare
run: |
echo "ref: ${{ needs.get_ref.outputs.ref }} "
echo "e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}"
echo "===== image "
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}"
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race"
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}"
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race"
echo "===== chart "
echo "chart package artifact: ${{ needs.call_release_chart.outputs.artifact }}"
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: ^1.17
id: go
- name: Install Tools
run: |
# install kind/p2ctl/helm/ginkgo
bash ./test/scripts/install-tools.sh
- name: Init Kind Cluster
run: |
make -C test kind-init
- name: Download spiderpool-agent image
uses: actions/download-artifact@v3
with:
name: image-tar-spiderpool-agent
path: test/.download
- name: Download spiderpool-controller image
uses: actions/download-artifact@v3
with:
name: image-tar-spiderpool-controller
path: test/.download
- name: Load Image to Kind
run: |
make load-image-to-kind E2E_CLUSTER_NAME=${{ env.CLUSTER_NAME }}
- name: Helm Install Spiderpool
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
shell: bash
command: |
make apply-chart-to-kind E2E_CLUSTER_NAME=${{ env.CLUSTER_NAME }}
- name: Run e2e
id: e2e
continue-on-error: true
run: |
echo ${{ github.event.inputs.labels }}
make -C test e2e-test E2E_CLUSTER_NAME=${{ env.CLUSTER_NAME }} E2E_GINKGO_LABELS=${{ needs.get_ref.outputs.e2e_labels }} E2E_TIMEOUT=${{ env.E2E_TIME_OUT }}
if (($?==0)) ; then
echo ::set-output name=pass::true
else
echo ::set-output name=pass::false
fi
if [ -f "./e2ereport.json" ] ; then
echo "error, did not find e2e report"
echo ::set-output name=upload::true
else
echo ::set-output name=upload::false
fi
- name: Upload e2e report
if: ${{ steps.e2e.outputs.upload == 'true' }}
uses: actions/[email protected]
with:
name: e2ereport.json
path: e2ereport.json
retention-days: 1
- name: Show e2e Result
run: |
if ${{ steps.e2e.outputs.pass == 'true' }} ;then
exit 0
else
exit 1
fi