-
Notifications
You must be signed in to change notification settings - Fork 794
/
Copy pathTaskfile.yml
79 lines (70 loc) · 2.81 KB
/
Taskfile.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
# Copyright 2024 The Outline Authors
#
# 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
#
# 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.
version: '3'
requires:
vars: [OUTPUT_BASE]
tasks:
clean:
desc: Clean metrics server output
cmds:
- rm -rf "{{.OUTPUT_BASE}}"
build:
desc: Build the metrics server
vars:
BUILD_MODE: '{{.BUILD_MODE | default "dev"}}'
TARGET_DIR: &default-target-dir '{{joinPath .OUTPUT_BASE .BUILD_MODE}}'
cmds:
- rm -rf '{{.TARGET_DIR}}'
- npx tsc --project '{{.TASKFILE_DIR}}' --outDir '{{.TARGET_DIR}}'
- cp '{{joinPath .TASKFILE_DIR "package.json"}}' '{{.TARGET_DIR}}'
- cp '{{joinPath .USER_WORKING_DIR "package-lock.json"}}' '{{.TARGET_DIR}}'
- cp '{{.TASKFILE_DIR}}/app_{{.BUILD_MODE}}.yaml' '{{.TARGET_DIR}}/app.yaml'
- cp '{{.TASKFILE_DIR}}/config_{{.BUILD_MODE}}.json' '{{.TARGET_DIR}}/config.json'
deploy:dev:
desc: Deploy the development metrics server
vars:
BUILD_MODE: "dev"
TARGET_DIR: *default-target-dir
deps: [{task: build, vars: {BUILD_MODE: "{{.BUILD_MODE}}", TARGET_DIR: "{{.TARGET_DIR}}"}}]
cmds:
- gcloud app deploy '{{.TASKFILE_DIR}}/dispatch.yaml' '{{.TARGET_DIR}}' --project uproxysite --verbosity info --promote --stop-previous-version
deploy:prod:
desc: Deploy the production metrics server
vars:
BUILD_MODE: "prod"
TARGET_DIR: *default-target-dir
deps: [{task: build, vars: {BUILD_MODE: "{{.BUILD_MODE}}", TARGET_DIR: "{{.TARGET_DIR}}"}}]
cmds:
- gcloud app deploy '{{.TASKFILE_DIR}}/dispatch.yaml' '{{joinPath .OUTPUT_BASE "prod"}}' --project uproxysite --verbosity info --no-promote --no-stop-previous-version
start:
desc: Start the metrics server locally
vars:
BUILD_MODE: '{{.BUILD_MODE | default "dev"}}'
TARGET_DIR: *default-target-dir
deps: [{task: build, vars: {BUILD_MODE: "{{.BUILD_MODE}}", TARGET_DIR: "{{.TARGET_DIR}}"}}]
cmds:
- node '{{joinPath .TARGET_DIR "index.js"}}'
integration_test:
desc: Test the deployed dev metrics server
cmds:
- '{{.TASKFILE_DIR}}/test_integration.sh'
test:
desc: Run the unit tests for the metrics server
vars:
TEST_DIR:
sh: "mktemp -d"
cmds:
- defer: rm -rf "{{.TEST_DIR}}"
- npx tsc -p '{{.TASKFILE_DIR}}' --outDir '{{.TEST_DIR}}'
- npx jasmine '{{.TEST_DIR}}/**/*.spec.js'