-
Notifications
You must be signed in to change notification settings - Fork 440
178 lines (171 loc) · 6.29 KB
/
integration.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Integration Tests
on:
workflow_call:
inputs:
skip_setup:
description: Skip the version and build step and use parent
default: false
required: false
type: boolean
concurrency_group_prefix:
default: pr
required: false
type: string
concurrency:
group: ${{ inputs.concurrency_group_prefix }}-integration-${{ github.head_ref }}
cancel-in-progress: true
jobs:
prepare-integration-tests:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.build-test-matrix.outputs.tests }}
container:
image: docker.mirror.hashicorp.services/hashicorp/jsii-terraform
env:
CHECKPOINT_DISABLE: "1"
timeout-minutes: 60
steps:
- uses: actions/checkout@v3.1.0
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3.0.11
id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: install dependencies
run: yarn install
- name: set version
if: ${{ !inputs.skip_setup }}
run: tools/align-version.sh "-dev.$GITHUB_RUN_ID"
- name: build and package
if: ${{ !inputs.skip_setup }}
run: |
yarn build
yarn package
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins
GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache
- name: Upload dist
uses: actions/upload-artifact@v3.1.1
if: ${{ !inputs.skip_setup }}
with:
name: dist
path: dist
- name: Upload edge-provider bindings
uses: actions/upload-artifact@v3.1.1
if: ${{ !inputs.skip_setup }}
with:
name: edge-provider-bindings
path: packages/@cdktf/provider-generator/edge-provider-bindings
- name: installing test dependencies
run: |
cd test && yarn install
- id: build-test-matrix
run: |
./tools/build-test-matrix.sh
linux_integration:
needs: prepare-integration-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.prepare-integration-tests.outputs.tests)}}
container:
image: docker.mirror.hashicorp.services/hashicorp/jsii-terraform
env:
CHECKPOINT_DISABLE: "1"
TERRAFORM_VERSION: ${{ matrix.terraform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3.1.0
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3.0.11
id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Download dist
uses: actions/download-artifact@v3.0.1
with:
name: dist
path: dist
- name: Download edge-provider bindings
uses: actions/download-artifact@v3.0.1
with:
name: edge-provider-bindings
path: test/edge-provider-bindings
- name: install test dependencies
run: cd test && yarn
- name: integration tests
run: cd test && ./run-against-dist npx jest ${TEST_TARGET}
env:
TEST_TARGET: ${{ matrix.target }}
TERRAFORM_CLOUD_TOKEN: ${{ secrets.TERRAFORM_CLOUD_TOKEN }}
TERRAFORM_BINARY_NAME: "terraform${{ matrix.terraform }}"
NODE_OPTIONS: "--max-old-space-size=7168"
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins
GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache
windows_integration:
needs: prepare-integration-tests
runs-on: windows-2019
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.prepare-integration-tests.outputs.tests)}}
env:
CHECKPOINT_DISABLE: "1"
TERRAFORM_VERSION: ${{ matrix.terraform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3.1.0
- name: Get yarn cache directory path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3.0.11
id: global-cache # use this to check for `cache-hit` (`steps.global-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.global-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: HashiCorp - Setup Terraform
uses: hashicorp/setup-terraform@v2.0.3
with:
terraform_wrapper: false
terraform_version: ${{ matrix.terraform }}
- name: Install pipenv
run: pip install pipenv
- name: Install Go
uses: actions/setup-go@v3.3.1
with:
go-version: 1.18.x
- name: Download dist
uses: actions/download-artifact@v3.0.1
with:
name: dist
path: dist
- name: Download edge-provider bindings
uses: actions/download-artifact@v3.0.1
with:
name: edge-provider-bindings
path: test/edge-provider-bindings
# tmp fix for https://github.com/npm/cli/issues/4980
- name: update npm
run: npm install -g npm@8.12.1
- name: install test dependencies
run: cd test && yarn
- name: integration tests
run: cd test && ./run-against-dist.bat "npx jest --ci ${env:TEST_TARGET}"
env:
TEST_TARGET: ${{ matrix.target }}
TERRAFORM_CLOUD_TOKEN: ${{ secrets.TERRAFORM_CLOUD_TOKEN }}
NODE_OPTIONS: "--max-old-space-size=7168"
TF_PLUGIN_CACHE_DIR: ${{ steps.global-cache-dir-path.outputs.dir }}/terraform-plugins
GOCACHE: ${{ steps.global-cache-dir-path.outputs.dir }}/go-cache