-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathTaskfile
executable file
·171 lines (139 loc) · 3.77 KB
/
Taskfile
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
#!/bin/bash
#
# PRIVATE
#
#
# _run-dc name command...
#
# Runs docker compose with the given docker compose filename suffix with the given command arguments
#
function _run-dc {
docker compose -f "etc/docker-compose-${1}.yml" --project-directory "${PWD}" --project-name orcidlink run --rm orcidlink "${@:2}"
}
function _dc-up {
docker compose -f "etc/docker-compose-${1}.yml" --project-directory "${PWD}" --project-name orcidlink up
}
function _noop {
echo "Not implemented yet"
}
#
# PUBLIC
#
function alias-me {
alias run="${PWD}/Taskfile"
}
function install-plugins {
bash tools/deno/scripts/install-plugins.sh "${GH_TOKEN:?GH_TOKEN is required}"
}
function install-plugin {
bash tools/deno/scripts/install-plugin.sh "${1}"
}
function git-info {
bash tools/deno/scripts/git-info.sh
}
function build-info {
bash tools/deno/scripts/build-info.sh
}
function prepare-build {
bash scripts/host/prepare-build.sh
}
function create-deploy {
bash scripts/host/create-deploy.sh
}
function build {
env DIR="${PWD}/vite-app" bash scripts/host/build.sh
}
function shell {
env DIR="${PWD}" bash scripts/host/shell.sh
}
function test {
env DIR="${PWD}/vite-app" bash scripts/host/test.sh
}
#
# Build
#
#
# Sets up the project for either development or image-building
#
function setup-for-build-or-dev {
prepare-build
git-info
build-info
install-plugins
render-templates
}
#
# Prepare a build for an image
# After this is complete, everything will be in place for the image
# to be built.
#
function build-kbase-ui {
setup-for-build-or-dev
build
create-deploy
}
#
# Prepare project for development.
# After this is complete, the repo is ready for live development
#
function dev-setup {
setup-for-build-or-dev
}
#
# Tasks we need to run prior to commits, etc.
#
function format {
_noop
}
function render-templates {
env DIR="${PWD}" ENV="${ENV:-ci}" DEFAULT_PATH="${DEFAULT_PATH}" bash tools/dockerize/scripts/render-templates.sh
}
# Optional dev tooling:
function generate-dev-cert {
env bash tools/make-dev-cert.sh
}
function remove-dev-cert {
rm tools/proxy/contents/ssl/*
}
function start-local-server {
docker compose up
}
#
# TO PORT
#
# docker-network:
# @:$(call check_defined, net, "the docker custom network: defaults to 'kbase-dev'")
# bash tools/docker/create-docker-network.sh $(net)
# docker-ignore:
# @echo "> Syncing .dockerignore from .gitignore"
# @$(TOPDIR)/node_modules/.bin/dockerignore
# docker-network-clean:
# # @:$(call check_defined, net, "the docker custom network: defaults to 'kbase-dev'")
# bash tools/docker/clean-docker-network.sh
# get-gitlab-config:
# mkdir -p dev/gitlab-config; \
# # git clone -b develop ssh://[email protected]/devops/kbase_ui_config.git dev/gitlab-config
# git clone -b develop https://gitlab.kbase.us/devops/kbase_ui_config.git
# dev/gitlab-config
# # check_defined variable-name message
# # Ensures that the given variable 'variable-name' is defined; if not
# # prints 'message' and the process exits with 1.
# # thanks https://stackoverflow.com/questions/10858261/abort-makefile-if-variable-not-set
# check_defined = \
# $(strip $(foreach 1,$1, \
# $(call __check_defined,$1,$(strip $(value 2)))))
# __check_defined = \
# $(if $(value $1),, \
# $(error Undefined "$1"$(if $2, ($2))$(if $(value @), \
# required by target `$@')))
function help {
echo "$0 <task> <args>"
echo "Runs the tasks listed below."
echo "To find out more about them, either read the source"
echo "for ${0} or the docs located in 'docs/tasks.md'."
echo "Tasks:"
# Note that this omits private functions - those prefixed with an _
compgen -A function | grep -e '^[^_]' | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time "${@:-help}"