This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (108 loc) · 4.24 KB
/
integration-test.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Integration tests
on:
push:
tags:
- "cloudflow_contrib_it_v*"
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
env:
PROJECT_ID: ${{ secrets.CLOUDFLOW_GKE_PROJECT }}
GKE_REGION: europe-west1
GKE_ZONE: europe-west1-b
DOCKER_REGISTRY: "eu.gcr.io"
DOCKER_REPOSITORY: ${{ secrets.CLOUDFLOW_GKE_PROJECT }}
MACHINE_ID: "cicon"
CLOUDFLOW_URL: "https://github.com/lightbend/cloudflow-contrib.git"
JAVA_OPTS: -Xms2048M -Xmx4096M -Xss2M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
jobs:
gke:
name: Run Cloudflow-contrib Integration tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: 'Set version'
env:
VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo "${VERSION}" | sed "s/cloudflow_contrib_it_v//" > .version
cat .version
- name: Set up JDK 11
uses: olafurpg/setup-scala@v10
with:
java-version: [email protected]
- name: Cache Coursier cache
uses: coursier/cache-action@v5
# Latest tagged version uses a deprecated github actions feature that is going to be removed on 16th nov
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@15dc2ebff158fa77e9b28e43515bae5f990345b4
with:
version: '290.0.1'
service_account_key: ${{ secrets.CLOUDFLOW_GKE_SA_KEY }}
project_id: ${{ secrets.CLOUDFLOW_GKE_PROJECT }}
# jq it's installed with snap to avoid permissions errors
## when reading files.
- name: Setup the cluster
shell: bash {0}
run: |
sudo snap install helm --classic
sudo snap install kubectl --classic
sudo snap install yq
sudo apt-get update && sudo apt-get install -y jq
export VERSION=$(cat .version)
gcloud config set compute/region ${GKE_REGION}
gcloud config set compute/zone ${GKE_ZONE}
export VERSION=$(cat .version)
git clone ${CLOUDFLOW_URL} --branch v${VERSION} --depth 1 --single-branch ./cloudflow-contrib
cat cloudflow-contrib/project/Dependencies.scala | grep 'val cloudflowVersion' | awk '{ print $4}' > .cloudflow-version
cat .cloudflow-version
export CLOUDFLOW_VERSION=$(cat .cloudflow-version)
cd cloudflow-contrib
cd cloudflow-it
make spawn-gke-cluster version=${CLOUDFLOW_VERSION}
gcloud --quiet auth configure-docker
make prepare-cluster version=${CLOUDFLOW_VERSION}
- name: Cache locally cloudflow-contrib to avoid sonatype delays
run: |
export VERSION=$(cat .version)
cd cloudflow-contrib
echo "ThisBuild / version := \"$VERSION\"" > version.sbt
sbt 'set ThisBuild / publishMavenStyle := false' +publishLocal
- name: Prepare swiss-knife
run: |
export VERSION=$(cat .version)
cd cloudflow-contrib
cd cloudflow-it
make prepare-swiss-knife version=${VERSION}
- name: Prepare clis
run: |
export VERSION=$(cat .version)
cd cloudflow-contrib
cd cloudflow-it
make prepare-clis version=${VERSION}
- name: Integration test
run: |
export VERSION=$(cat .version)
cd cloudflow-contrib
cd cloudflow-it
make run-it-tests version=${VERSION}
- name: Cleanup the environment
if: ${{ always() }}
shell: bash {0}
run: |
export VERSION=$(cat .version)
echo y | gcloud container images delete $DOCKER_REGISTRY/${{ secrets.CLOUDFLOW_GKE_PROJECT }}/swiss-knife-akka:$VERSION
echo y | gcloud container images delete $DOCKER_REGISTRY/${{ secrets.CLOUDFLOW_GKE_PROJECT }}/swiss-knife-flink:$VERSION
echo y | gcloud container images delete $DOCKER_REGISTRY/${{ secrets.CLOUDFLOW_GKE_PROJECT }}/swiss-knife-spark:$VERSION
(cd cloudflow-contrib/cloudflow-it && make delete-gke-cluster version=${VERSION})