generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 9
118 lines (104 loc) · 3.4 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
115
116
117
118
name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'
# schedule:
# - cron: '0 13 * * *'
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
id: go
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
test:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
terraform:
- '1.3.9'
- '1.4.6'
- '1.5.2'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build the docker-compose stack
env:
APPLICATION_SECRETS: ${{ secrets.APPLICATION_SECRETS }}
run: |
echo $APPLICATION_SECRETS | base64 -d > .github/docker/application-secrets.yml
docker-compose -f docker-compose-ci.yml pull
docker-compose -f docker-compose-ci.yml up -d zookeeper kafka elasticsearch vault
sleep 30
docker-compose -f docker-compose-ci.yml up -d
sleep 30
echo "\echo 'path \"*\" {capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\", \"sudo\"]}' | vault policy write admins -" | docker exec --interactive terraform-provider-kestra_vault_1 sh -
docker exec terraform-provider-kestra_vault_1 vault auth enable userpass
docker exec terraform-provider-kestra_vault_1 vault write auth/userpass/users/john \
password=foo \
policies=admins \
token_period=1s
docker ps -a
docker logs terraform-provider-kestra_kestra_1
curl "127.27.27.27:9200" > /dev/null
curl -X POST "127.27.27.27:8080/api/v1/users" > /dev/null
curl -H "Content-Type: application/x-ndjson" -XPOST "127.27.27.27:9200/_bulk?pretty" --data-binary @.github/workflows/index.jsonl
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.18'
id: go
- name: Get dependencies
run: |
go mod download
- name: Terraform acceptance tests
timeout-minutes: 10
env:
TF_ACC: "1"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
KESTRA_URL: "http://127.27.27.27:8080"
KESTRA_USERNAME: [email protected]
KESTRA_PASSWORD: pass
run: |
go test -v -cover ./internal/provider/
# Slack
- name: Slack notification
uses: 8398a7/action-slack@v3
if: failure() && github.event_name != 'pull_request'
with:
status: ${{ job.status }}
job_name: Matrix Test
fields: repo,commit,action,ref,job,took
username: GitHub Actions
icon_emoji: ':github-actions:'
channel: 'C02DQ1A7JLR'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}