-
Notifications
You must be signed in to change notification settings - Fork 3
142 lines (117 loc) · 4.44 KB
/
action.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
# Copyright 2022 Google LLC
#
# Licensed 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
#
# https://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.
# This is a basic workflow to help you get started with Actions
name: spanner-stress-demo-auto-test
# Controls when the workflow will run
on:
push:
branches:
- main
pull_request:
types: [synchronize, opened]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: [ubuntu-latest]
# Steps represent a sequence of tasks that will be executed as part of the job
timeout-minutes: 30
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Pull repo
uses: actions/checkout@v3
- name: Read python version file
id: python-version
uses: juliangruber/read-file-action@v1
with:
path: .python-version
- name: Install python
uses: gabrielfalcao/pyenv-action@v16
with:
default: "${{ steps.python-version.outputs.content }}"
command: |
pip install -U pip
pip install pipenv
- name: Lint check for python files
run: |
pip install flake8
flake8 . --ignore=E501 --extend-exclude=terraform
- name: Lint check for yaml files
run: |
pip install yamllint
yamllint -d "{extends: relaxed, rules: {line-length: {max: 200}}}" -f standard ./
- name: Lint check for terraform files
uses: actionshub/terraform-lint@main
- name: Read terraform version file
id: terraform-version
uses: juliangruber/read-file-action@v1
with:
path: .terraform-version
- name: Install terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: "${{ steps.terraform-version.outputs.content }}"
- name: Validate terraform files
run: |
cp .env_sample .env && make terraform.init
cd terraform && terraform validate
- name: Install dev package in local
run: cd apps && pipenv install --dev
- name: Install google-cloud-cli
run: |
bash <(curl https://sdk.cloud.google.com) --disable-prompts --install-dir=/usr/local/bin
echo "/usr/local/bin/google-cloud-sdk/bin" >> $GITHUB_PATH
- name: Create config for unit-test
run: make create.emulator.config
- name: Set emulator config
run: make set.emulator.config
- name: Run spanner emulator container
run: docker-compose up -d spanner
- name: Create database in spanner emulator
run: |
sleep 3
make create.emulator.database
- name: Run unit-test
run: cd apps && ENV=local SPANNER_EMULATOR_HOST=localhost:9010 GOOGLE_CLOUD_PROJECT=test-local pipenv run ci_test
# - name: Submit coverage comments of unit-test
# id: coverage_comment
# uses: MishaKav/pytest-coverage-comment@main
# with:
# pytest-xml-coverage-path: ./apps/coverage.xml
# junitxml-path: ./apps/pytest.xml
- name: Run app container
run: |
docker-compose down
make run.local-app
- name: Run integration-test to load master data
run: |
pip install -r apps/scripts/requirements.txt
python ./apps/scripts/main.py -l 10
- name: Run integration-test of simple stress test in local
run: make run.local-locust
- name: Check the number of running container
run: |
sleep 10
if [ $(docker-compose ps | grep Up | wc -l) -ne 6 ]
then
echo "Does not running some containers"
docker-compose ps
exit 1
fi
- name: Output locust logs to check failed-rate
run: docker-compose logs --tail=200 locust
- name: Stop containers
if: always()
run: docker-compose down