-
Notifications
You must be signed in to change notification settings - Fork 510
135 lines (130 loc) · 4.51 KB
/
deploy-cf-it.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
name: deploy-cloud-functions Integration
on:
push:
paths:
- 'deploy-cloud-functions/**'
- '.github/workflows/deploy-cf**'
pull_request:
paths:
- 'deploy-cloud-functions/**'
- '.github/workflows/deploy-cf**'
jobs:
gcloud:
name: with setup-gcloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master # Set up ADC for credentials
with:
service_account_email: ${{ secrets.DEPLOY_CF_SA_EMAIL }}
service_account_key: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
export_default_credentials: true
- id: build
name: Build dist
working-directory: deploy-cloud-functions
run: |-
npm install
npm run build
- id: deploy
uses: ./deploy-cloud-functions
with:
name: cf-http-gcloud-${{ github.run_number }}
runtime: nodejs10
entry_point: helloWorld
source_dir: ./deploy-cloud-functions/tests/test-node-func/
- uses: actions/setup-node@master
with:
node-version: 12.x
- run: npm install
working-directory: ./deploy-cloud-functions
- name: integration tests
run: npm run e2e-tests
working-directory: ./deploy-cloud-functions
env:
URL: ${{ steps.deploy.outputs.url }}
- name: integration test clean up
run: npm run cleanup
working-directory: ./deploy-cloud-functions
env:
DEPLOY_CF_SA_KEY_JSON: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
CF_NAME: projects/${{ secrets.DEPLOY_CF_PROJECT_ID }}/locations/us-central1/functions/cf-http-gcloud-${{ github.run_number }}
b64_json:
name: with base64 json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
working-directory: deploy-cloud-functions
run: |-
npm install
npm run build
- id: deploy
uses: ./deploy-cloud-functions
with:
name: cf-http-b64-${{ github.run_number }}
runtime: nodejs10
entry_point: helloWorld
source_dir: ./deploy-cloud-functions/tests/test-node-func/
credentials: ${{ secrets.DEPLOY_CF_SA_KEY_B64 }}
- uses: actions/setup-node@master
with:
node-version: 12.x
- run: npm install
working-directory: ./deploy-cloud-functions
- uses: google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
with:
service_account_email: ${{ secrets.DEPLOY_CF_SA_EMAIL }}
service_account_key: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
export_default_credentials: true
- name: integration tests
run: npm run e2e-tests
working-directory: ./deploy-cloud-functions
env:
URL: ${{ steps.deploy.outputs.url }}
- name: integration test clean up
run: npm run cleanup
working-directory: ./deploy-cloud-functions
env:
DEPLOY_CF_SA_KEY_JSON: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
CF_NAME: projects/${{ secrets.DEPLOY_CF_PROJECT_ID }}/locations/us-central1/functions/cf-http-b64-${{ github.run_number }}
json:
name: with json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
working-directory: deploy-cloud-functions
run: |-
npm install
npm run build
- id: deploy
uses: ./deploy-cloud-functions
with:
name: cf-http-json-${{ github.run_number }}
runtime: nodejs10
entry_point: helloWorld
source_dir: ./deploy-cloud-functions/tests/test-node-func/
credentials: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
- uses: actions/setup-node@master
with:
node-version: 12.x
- run: npm install
working-directory: ./deploy-cloud-functions
- uses: google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
with:
service_account_email: ${{ secrets.DEPLOY_CF_SA_EMAIL }}
service_account_key: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
export_default_credentials: true
- name: integration tests
run: npm run e2e-tests
working-directory: ./deploy-cloud-functions
env:
URL: ${{ steps.deploy.outputs.url }}
- name: integration test clean up
run: npm run cleanup
working-directory: ./deploy-cloud-functions
env:
DEPLOY_CF_SA_KEY_JSON: ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
CF_NAME: projects/${{ secrets.DEPLOY_CF_PROJECT_ID }}/locations/us-central1/functions/cf-http-json-${{ github.run_number }}