-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
156 lines (130 loc) · 4.11 KB
/
Taskfile.yml
File metadata and controls
156 lines (130 loc) · 4.11 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
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
version: '3'
vars:
MODEL_REPO: git@github.com:AKSW/aksw.org-model.git
MODEL_DIR: .aksw-model
GRAPH_FILE: aksw.org
GRAPH_IRI:
sh: cat {{.MODEL_DIR}}/{{.GRAPH_FILE}}.nt.graph || echo none
GIT_USER_NAME: AKSW Update Bot 🤖
GIT_USER_EMAIL: aksw.org-update-bot@aksw.org
GIT_COMMIT_MESSAGE: Update via pipeline
WORKING_DIRECTORY: '{{.github.workspace | default .PWD}}'
ID_UID:
sh: id -u
ID_GID:
sh: id -g
MODEL_DOCKER_NETWORK: '{{.MODEL_EXTERNAL_DOCKER_NETWORK | default "aksw_data"}}'
JEKYLL_UID: '{{.JEKYLL_UID | default .ID_UID}}'
JEKYLL_GID: '{{.JEKYLL_GID | default .ID_GID}}'
JEKYLL_USER_ARG:
sh: '[ "$(docker info --format "{{`{{if .Host.Security.Rootless}}true{{end}}`}}")" = "true" ] || echo -u "{{.JEKYLL_UID}}:{{.JEKYLL_GID}}"'
JEKYLL_IMAGE: ghcr.io/aksw/jekyll-rdf:4.1.2
TARGET: '{{.TARGET | default "_site"}}'
BUILD_WATCH_FILES: find . -name '*' -not -path "./.git/*" -not -path "./.git" -not -path "./.jekyll-cache/*" -not -path "./.jekyll-cache" -not -path "./src/*" -not -path "./src"
STYLE_WATCH_FILES: find ./src -name '*'
tasks:
default:
desc: List all tasks
cmds:
- task -a
ci:
desc: Build tasks for the CI
deps:
- task: data:model-update
- task: style:build
cmds:
- task: build
build:
desc: Build the page
deps:
- task: data:model-serve
cmds:
- task: build:docker
vars:
TARGET: '{{.TARGET}}'
watch:
desc: Serve the page and rebuild it on changes
deps:
- task: serve
- task: build:watch
- task: style:watch
cmds:
- echo "Terminate"
serve:
desc: Serve the locally built site
cmds:
- python -m http.server --directory {{.TARGET}}
clean:
desc: Remove some residuals
cmds:
- task: clean:docker
clean:docker:
desc: Remove some docker residuals
cmds:
- task: data:model-serve-stop
- docker network rm {{.MODEL_DOCKER_NETWORK}}
clean:cache:
desc: Remove caches and dependencies
cmds:
- rm -rf .vendor || true
- rm -rf node_modules || true
- rm -rf .jekyll-cache || true
clean:dist:
desc: Remove all generated artifacts
desp:
- task: clean:docker
- task: clean:cache
cmds:
- rm -rf {{.MODEL_DIR}} || true
build:watch:
desc: Watch for changes in the directory and rebuild the page, should be combined with task serve in a second terminal
cmds:
- '{{.BUILD_WATCH_FILES}} | entr task build'
build:docker:
- |
docker run --rm \
--workdir /github/workspace \
--network {{.MODEL_DOCKER_NETWORK}} \
-v {{.WORKING_DIRECTORY}}:/github/workspace \
-e TZ=Europe/Berlin {{.JEKYLL_USER_ARG}} -e BUNDLE_PATH=.vendor \
{{.JEKYLL_IMAGE}} jekyll build --config _config.yml -d {{.TARGET}}
style:install:
cmds:
- npm install
status:
- test -d node_modules
style:build:
deps:
- task: style:install
cmds:
- npm run build
style:watch:
desc: Watch for changes in the styles and scripts directory and rebuild the webpack
cmds:
- '{{.STYLE_WATCH_FILES}} | entr task style:build'
data:model-update:
deps:
- task: data:model-init
- task: data:model-serve-stop
cmds:
- cd {{.MODEL_DIR}} && git pull
data:model-init:
cmds:
- git clone git@github.com:AKSW/aksw.org-model.git {{.MODEL_DIR}}
status:
- test -d {{.MODEL_DIR}}
data:model-serve:
deps:
- task: data:model-init
- task: data:docker-network
cmds:
- docker run --rm -p 3030:3030 --name aksw.org_model --network {{.MODEL_DOCKER_NETWORK}} -v {{.PWD}}/{{.MODEL_DIR}}/:/graph -d docker.io/stain/jena-fuseki /jena-fuseki/fuseki-server --file=/graph/{{.GRAPH_FILE}}.nt /aksw
status:
- '[ "$( docker inspect --format "{{`{{.State.Running}}`}}" aksw.org_model )" = "true" ]'
data:model-serve-stop:
- docker stop aksw.org_model || echo "data container not running, don't need to stop it"
data:docker-network:
cmds:
- docker network create {{.MODEL_DOCKER_NETWORK}}
status:
- 'docker network inspect {{.MODEL_DOCKER_NETWORK}}'