-
Notifications
You must be signed in to change notification settings - Fork 4
114 lines (97 loc) · 4.8 KB
/
test.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: "Run tests"
on:
- pull_request
env:
GOSSVERSION: v0.4.4
jobs:
test:
strategy:
matrix:
flavour:
- aws
- azure
# Commented until gcloud playground exists
#- gcloud
- simple
- tanzu
arch:
- linux/amd64
# Commented until Github supports arm64 runners
#- linux/arm64
exclude:
- flavour: "azure"
arch: "linux/arm64"
- flavour: "tanzu"
arch: "linux/arm64"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Prepare flavour data (common)
run: |
mkdir .testbed
- name: Prepare flavour data (azure)
if: matrix.flavour == 'azure'
run: |
echo "AZ_SUBSCRIPTION=${{ secrets.TEST_AZURE_SUBSCRIPTION }}" > .testbed/.env
echo "AZ_K8S_CLUSTERS=${{ secrets.TEST_AZURE_K8SCLUSTERS }}" >> .testbed/.env
echo "AZ_TENANTID=${{ secrets.TEST_AZURE_TENANTID }}" >> .testbed/.env
echo "ARM_SUBSCRIPTION_ID=${{ secrets.TEST_AZURE_SUBSCRIPTION }}" >> .testbed/.env
echo "ARM_CLIENT_ID=${{ secrets.TEST_AZURE_CLIENT_ID }}" >> .testbed/.env
echo "ARM_CLIENT_SECRET=${{ secrets.TEST_AZURE_CLIENT_SECRET }}" >> .testbed/.env
echo "AZ_USE_ARM_SPI=true" >> .testbed/.env
- name: Prepare flavour data (aws)
if: matrix.flavour == 'aws'
run: |
echo "AWS_ACCESS_KEY_ID=${{ secrets.TEST_AWS_ACCESS_KEY_ID }}" > .testbed/.env
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}" >> .testbed/.env
echo "AWS_DEFAULT_REGION=${{ secrets.TEST_AWS_DEFAULT_REGION }}" >> .testbed/.env
echo "AWS_K8S_CLUSTERS=${{ secrets.TEST_AWS_K8S_CLUSTERS }}" >> .testbed/.env
echo "AWS_SKIP_GPG=1" >> .testbed/.env
- name: Prepare flavour data (gcloud)
if: matrix.flavour == 'gcloud'
run: |
echo "${{ secrets.TEST_GCLOUD_KEY_JSON }}" | base64 -d > .testbed/gcloud_key.json
echo "GCLOUD_PROJECTID=${{ secrets.TEST_GCLOUD_PROJECT }}" > .testbed/.env
echo "GCLOUD_K8S_CLUSTERS=${{ secrets.TEST_GCLOUD_K8SCLUSTERS }}" >> .testbed/.env
echo "GCLOUD_KEYPATH=/flavour/gcloud_key.json" >> .testbed/.env
- name: Prepare flavour container
run: |
cat build/Dockerfile.prefix > Dockerfile
cat "flavour/${{ matrix.flavour }}/Dockerfile.flavour" >> Dockerfile
# Download mo
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
chmod +x mo
cat build/Dockerfile.suffix.mo | BUILD_DATE=$(date -Iseconds) FLAVOUR=${{ matrix.flavour }} ./mo > build/Dockerfile.suffix
cat build/Dockerfile.suffix >> Dockerfile
rm mo
- name: build flavour container
id: build-and-push
uses: docker/[email protected]
with:
context: .
pull: true
tags: test-image-${{ matrix.flavour }}-${{ matrix.arch}}:local
load: true
no-cache: true
platforms: ${{ matrix.arch }}
- name: Run Tests
run: |
set -x
GOSS_ARCH=$(echo "${{ matrix.arch }}" | tr / -)
curl -sL "https://github.com/goss-org/goss/releases/download/${{ env.GOSSVERSION }}/goss-${GOSS_ARCH}" -o goss
chmod +x goss
go build cmd/tests/test-features.go
./test-features -c -f ${{ matrix.flavour }} -i test-image-${{ matrix.flavour }}-${{ matrix.arch }}:local -p ${{ matrix.arch }} -t ${PWD}/.testbed -g ${PWD}/goss -l debug
- name: Cleanup
run: |
rm -rf .testbed
rm goss