-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (47 loc) · 1.54 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: tests
on:
pull_request:
branches:
- main
types: [opened, reopened, synchronize]
jobs:
e2e-tests:
name: e2e-tests
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
REPOSITORY_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- name: Set Kubernetes context
uses: Azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.HNS_CI_CLUSTER }}
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run go vet
run: go vet ./...
- name: Log into ghcr.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Add IMAGE_TAG env property with commit short sha
run: echo "IMAGE_TAG=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Build and push docker image
run: make docker-build docker-push IMG=${{ env.REGISTRY }}/${{ env.REPOSITORY_NAME }}:${IMAGE_TAG}
- name: Deploy HNS
run: make install deploy IMG=${{ env.REGISTRY }}/${{ env.REPOSITORY_NAME }}:${IMAGE_TAG}
- name: Run e2e tests
run: make test-e2e
- name: Undeploy HNS
run: make undeploy
if: always()