-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Expand file tree
/
Copy pathtour_of_beam_backend_integration.yml
More file actions
130 lines (113 loc) · 4.86 KB
/
tour_of_beam_backend_integration.yml
File metadata and controls
130 lines (113 loc) · 4.86 KB
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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# To learn more about GitHub Actions in Apache Beam check the CI.md
name: Tour of Beam Go integration tests
on:
push:
branches: ['master', 'release-*']
tags: 'v*'
paths:
- '.github/workflows/tour_of_beam_backend_integration.yml'
- 'learning/tour-of-beam/backend/**'
- 'playground/backend/**'
pull_request:
branches: ['master', 'release-*']
tags: 'v*'
paths:
- '.github/workflows/tour_of_beam_backend_integration.yml'
- 'learning/tour-of-beam/backend/**'
- 'playground/backend/**'
schedule:
- cron: '0 10 * * 6'
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.event.pull_request.head.label || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login}}'
cancel-in-progress: true
env:
TOB_LEARNING_ROOT: ./samples/learning-content
# firebase
GOOGLE_CLOUD_PROJECT: demo-test-proj
FIREBASE_AUTH_EMULATOR_HOST: localhost:9099
# datastore
DATASTORE_PROJECT_ID: demo-test-proj
DATASTORE_EMULATOR_HOST: localhost:8081
DATASTORE_EMULATOR_DATADIR: ./datadir
# playground API
PLAYGROUND_ROUTER_HOST: localhost:8000
# GCF
PORT_SDK_LIST: 8801
PORT_GET_CONTENT_TREE: 8802
PORT_GET_UNIT_CONTENT: 8803
PORT_GET_USER_PROGRESS: 8804
PORT_POST_UNIT_COMPLETE: 8805
PORT_POST_USER_CODE: 8806
PORT_POST_DELETE_PROGRESS: 8807
# Gradle Enterprise
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
jobs:
integration:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./learning/tour-of-beam/backend
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment-action
with:
# pin to the biggest Go version supported by Cloud Functions runtime
go-version: '1.16'
- name: Build Playground router image
run: ./gradlew -i playground:backend:containers:router:docker
working-directory: ${{ env.GITHUB_WORKSPACE }}
# 1. Start emulators
- name: Start emulators
run: docker compose up -d
# 2. start function-framework processes in BG
- name: Compile CF
run: go build -o ./tob_function cmd/main.go
- name: Run getSdkList in background
run: PORT=${{ env.PORT_SDK_LIST }} FUNCTION_TARGET=getSdkList ./tob_function &
- name: Run getContentTree in background
run: PORT=${{ env.PORT_GET_CONTENT_TREE }} FUNCTION_TARGET=getContentTree ./tob_function &
- name: Run getUnitContent in background
run: PORT=${{ env.PORT_GET_UNIT_CONTENT }} FUNCTION_TARGET=getUnitContent ./tob_function &
- name: Run getUserProgress in background
run: PORT=${{ env.PORT_GET_USER_PROGRESS }} FUNCTION_TARGET=getUserProgress ./tob_function &
- name: Run postUnitComplete in background
run: PORT=${{ env.PORT_POST_UNIT_COMPLETE }} FUNCTION_TARGET=postUnitComplete ./tob_function &
- name: Run postUserCode in background
run: PORT=${{ env.PORT_POST_USER_CODE }} FUNCTION_TARGET=postUserCode ./tob_function &
- name: Run postDeleteProgress in background
run: PORT=${{ env.PORT_POST_DELETE_PROGRESS }} FUNCTION_TARGET=postDeleteProgress ./tob_function &
# 3. Load data in datastore: run CD step on samples/learning-content
- name: Run CI/CD to populate datastore
run: go run cmd/ci_cd/ci_cd.go
# 4. run integration tests
- name: Go integration tests
run: go test -v --tags integration ./integration_tests/...
- name: Stop emulators
if: always()
run: docker compose down
# 5. Compare storage/datastore/index.yml VS generated
- name: Check index.yaml
run: |
diff -q "${{ env.DATASTORE_EMULATOR_DATADIR }}/WEB-INF/index.yaml" \
internal/storage/index.yaml \
|| ( echo "index.yaml mismatch"; exit 1)