forked from hazelcast/hazelcast
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.08 KB
/
gcp-terraform-integration-tests.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
name: gcp-test
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'hazelcast/src/main/java/com/hazelcast/gcp/**'
- '.github/terraform/gcp/**'
jobs:
build:
defaults:
run:
shell: bash
env:
GCP_KEY_FILE: ${{ secrets.GCP_KEY_FILE }}
runs-on: ubuntu-latest
if: github.repository_owner == 'hazelcast'
strategy:
matrix:
java: [ '8' ]
architecture: [ 'x64' ]
distribution: [ 'adopt' ]
steps:
# SET UP JDK
- name: Setup JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
- run: java -version
# BUILD HAZELCAST GCP SNAPSHOT
- uses: actions/[email protected]
with:
path: hazelcast
- name: Build hazelcast jar
run: |
cd hazelcast
mvn clean install -DskipTests -Dcheckstyle.skip
echo "Hazelcast jar is: " hazelcast/target/hazelcast-*-SNAPSHOT.jar
cp hazelcast/target/hazelcast-*-SNAPSHOT.jar ~/hazelcast.jar
- name: Create GCP credentials file
run: |
touch gcp_key_file.json
echo $GCP_KEY_FILE > gcp_key_file.json
# INSTALL TERRAFORM
- name : Set-up Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 1.1.8
- name: Terraform Init
working-directory: hazelcast/.github/terraform/gcp
run: terraform init
- name: Terraform Apply
working-directory: hazelcast/.github/terraform/gcp
run: |
project_id=$(echo $GCP_KEY_FILE | grep -Po '"project_id":\s"\K[-a-zA-Z0-9]+')
terraform apply -var="hazelcast_mancenter_version=latest-snapshot" -var="hazelcast_path=~/hazelcast.jar" -var="gcp_key_file=~/gcp_key_file.json" -var="project_id=${project_id}" -auto-approve
- name: Terraform Destroy
if: ${{ always() }}
working-directory: hazelcast/.github/terraform/gcp
run: terraform destroy -auto-approve