-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
68 lines (59 loc) · 1.88 KB
/
.gitlab-ci.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
# References:
# - Gilab CI docs :: https://docs.gitlab.com/ee/topics/build_your_application.html
# - Gitlab CI YAML syntax reference :: https://docs.gitlab.com/ee/ci/yaml/index.html
# See https://hub.docker.com/_/clojure
# debian:bookworm base as of Jan 2024
image: clojure:tools-deps
# https://docs.gitlab.com/ee/ci/yaml/index.html#stages
stages:
- build
- deploy
variables:
CLJ_CACHE: $CI_PROJECT_DIR/.cache/clj
CLJ_MAVEN_CACHE: $CLJ_CACHE/maven
CLJ_GITLIBS_CACHE: $CLJ_CACHE/gitlibs
# These folders are cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
# TODO: Add yarn cache? Why am I using yarn anyway...
# TODO: Get clojure build to actually use the cache paths
cache:
paths:
- $CLJ_CACHE
- ./node_modules
#N.B. Some stuff adapted from here:
#https://medium.com/@dainius_jocas/using-gitlab-ci-cache-for-clojure-dependencies-31bb9bf5f003
#... to force clojure deps into a local folder for caching. May not work with shadow-cljs
release-build:
stage: build
#TODO: Move this to a new job in the '.pre' stage?
before_script:
# For an alpine base....
# - apk add --no-cache nodejs yarn
# Or a debian base....
- apt-get update
- apt-get install -y nodejs npm
- npm install --global yarn
script:
- yarn --version
- yarn install --dev
- echo "Clojure cache folders:\n $CLJ_CACHE (root)\n $CLJ_MAVEN_CACHE (maven deps)\n $CLJ_GITLIBS_CACHE (git deps)\n"
- export GITLIBS="$CLJ_GITLIBS_CACHE"
- yarn pages --config-merge '{:mvn/local-repo "$CLJ_MAVEN_CACHE"}'
artifacts:
paths:
- public
pages:
stage: deploy
dependencies:
- release-build
# No script required -- release build is to './public' by default
# .... but gitlab-ci requires a script section
script:
- ls public -al
artifacts:
paths:
- public
# Deploy from any branch for now...
# only:
# - develop
# - master