@@ -3,7 +3,7 @@ name: Pull Request
33on :
44 pull_request_target :
55 branches :
6- - master
6+ - ' master'
77 paths-ignore :
88 - ' *.md'
99 - ' docs/'
1212 - ' config/'
1313env :
1414 DOCKER_FILE_PATH : Dockerfile
15- GOLANG_VERSION : 1.16
16- KUBERNETES_VERSION : " 1.20.2 "
17- KIND_VERSION : " 0.10 .0"
15+ GOLANG_VERSION : 1.18
16+ HELM_VERSION : v3.8.2
17+ KIND_VERSION : " v0.17 .0"
1818
1919jobs :
2020 build :
21- runs-on : ubuntu-latest
22- name : Build
23- if : " ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') "
21+ runs-on : ubuntu-latest
22+ name : Pull Request
23+
2424 steps :
2525 - name : Check out code
26- uses : actions/checkout@v2
26+ uses : actions/checkout@v3
2727 with :
2828 ref : ${{github.event.pull_request.head.sha}}
2929
3030 - name : Set up Go
31- id : go
32- uses : actions/setup-go@v2
31+ uses : actions/setup-go@v3
3332 with :
3433 go-version : ${{ env.GOLANG_VERSION }}
3534
3635 - name : Lint
37- uses : golangci/golangci-lint-action@v2.3.0
36+ uses : golangci/golangci-lint-action@v3
3837 with :
39- version : v1.45.2
38+ version : v1.50.1
4039 only-new-issues : false
4140 args : --timeout 10m
4241
42+ # Set up helm binary
43+ - name : Set up Helm
44+ uses : azure/setup-helm@v3
45+ with :
46+ version : ${{ env.HELM_VERSION }}
47+
4348 - name : Helm Lint
4449 run : |
4550 helm lint charts/ingressmonitorcontroller
4651
47- - name : Install kubectl
48- run : |
49- curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
50- sudo install ./kubectl /usr/local/bin/ && rm kubectl
51- kubectl version --short --client
52- kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
52+ - name : Install kind
53+ 54+ with :
55+ version : ${{ env.KIND_VERSION }}
5356
54- - name : Install Kind
57+ - name : Check cluster info
5558 run : |
56- curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
57- sudo install ./kind /usr/local/bin && rm kind
59+ kubectl version --short --client
5860 kind version
5961 kind version | grep -q ${KIND_VERSION}
6062
61- - name : Create Kind Cluster
62- run : |
63- kind create cluster
64-
6563 - name : Set up Cluster
6664 run : |
6765 kubectl cluster-info
6866 make install
6967 mkdir -p .local
7068 echo "${{ secrets.SECRET_KUBERNETES_RESOURCES }}" | base64 --decode > .local/test-config.yaml
71-
69+
7270 - name : Test
7371 run : make test
7472
@@ -77,16 +75,20 @@ jobs:
7775 run : |
7876 sha=${{ github.event.pull_request.head.sha }}
7977 tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
80- echo "##[set-output name= GIT_TAG;] $(echo ${tag})"
81-
78+ echo "GIT_TAG= $(echo ${tag})" >> $GITHUB_OUTPUT
79+
8280 - name : Set up QEMU
83- uses : docker/setup-qemu-action@v1
81+ uses : docker/setup-qemu-action@v2
8482
8583 - name : Set up Docker Buildx
86- uses : docker/setup-buildx-action@v1
84+ uses : docker/setup-buildx-action@v2
85+ with :
86+ driver-opts : |
87+ image=moby/buildkit:v0.9.3
88+ buildkitd-flags : --debug
8789
8890 - name : Login to Registry
89- uses : docker/login-action@v1
91+ uses : docker/login-action@v2
9092 with :
9193 username : ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
9294 password : ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
@@ -96,13 +98,12 @@ jobs:
9698 echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
9799
98100 - name : Build and Push Docker Image
99- uses : docker/build-push-action@v2
101+ uses : docker/build-push-action@v4
100102 with :
101103 context : .
102104 file : ${{ env.DOCKER_FILE_PATH }}
103105 pull : true
104106 push : true
105- build-args : BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
106107 cache-to : type=inline
107108 tags : |
108109 ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
@@ -112,20 +113,13 @@ jobs:
112113 org.opencontainers.image.revision=${{ github.sha }}
113114
114115 - name : Comment on PR
115- uses : mshick/add-pr-comment@v1
116- env :
117- GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
118- with :
119- message : ' @${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
120- allow-repeats : false
121-
122- - name : Notify Failure
123- if : failure()
124- uses : mshick/add-pr-comment@v1
116+ uses : mshick/add-pr-comment@v2
117+ if : always()
125118 env :
126119 GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
127120 with :
128- message : ' @${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
121+ message-success : ' @${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
122+ message-failure : ' @${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
129123 allow-repeats : false
130124
131125 - name : Notify Slack
@@ -135,5 +129,4 @@ jobs:
135129 status : ${{ job.status }}
136130 fields : repo,author,action,eventName,ref,workflow
137131 env :
138- GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
139132 SLACK_WEBHOOK_URL : ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
0 commit comments