-
Notifications
You must be signed in to change notification settings - Fork 41
74 lines (68 loc) · 2.49 KB
/
test-gh.yml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: test-gh
on:
push:
branches:
- develop
paths-ignore:
- 'docs/**'
- '*.md'
- 'examples/**'
pull_request:
types: [opened, reopened, synchronize]
paths-ignore:
- 'docs/**'
- '*.md'
- 'examples/**'
jobs:
test-all:
name: Test GH
runs-on: ubuntu-latest
environment: DockerHub E2E
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.21.9"
- name: Check out code into the Go module directory
uses: actions/[email protected]
with:
path: src/github.com/${{ github.repository }}
fetch-depth: 0
- name: Install Carvel Tools
uses: carvel-dev/setup-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
only: ytt, kapp
- name: Run Tests
env:
DOCKERHUB_USERNAME: k8slt
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
run: |
set -e -x
minikube start --driver=docker --wait=all --mount --mount-string "$HOME:$HOME"
eval $(minikube docker-env --shell=bash)
# when this workflow runs of a pull request based on a fork, secrets are unavailable
# https://docs.github.com/en/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow
if [[ "${DOCKERHUB_ACCESS_TOKEN}" != "" ]]; then
# Authenticate to DockerHub to avoid test failures due to rate limiting
# ... for builders using Docker
set +x
echo "${DOCKERHUB_ACCESS_TOKEN}" | docker login --username "${DOCKERHUB_USERNAME}" --password-stdin
# ... for kubectl-buildkit
minikube kubectl --ssh=true -- create secret docker-registry buildkit \
--docker-username="${DOCKERHUB_USERNAME}" \
--docker-password="${DOCKERHUB_ACCESS_TOKEN}"
# ... for any other service account that pulls images from DockerHub
minikube kubectl --ssh=true -- create secret docker-registry dockerhub-credentials \
--docker-username="${DOCKERHUB_USERNAME}" \
--docker-password="${DOCKERHUB_ACCESS_TOKEN}"
set -x
else
echo "No DockerHub Access Token set; skipping Docker authentication. There may be rate limit errors."
fi
# Ensure that there is no existing kbld installed
rm -f /tmp/bin/kbld
cd "src/github.com/${{ github.repository }}"
export KBLD_E2E_SKIP_WHEN_HTTP_REGISTRY=true
./hack/build-binaries.sh
./hack/test-all-locally.sh