-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
166 lines (158 loc) · 5.02 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
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
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- update
- build
- docs
# The Nix before script. Cabal scripts defined locally.
before_script:
# Setup nix channels
- nix-channel --list;
- nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs;
- nix-channel --update;
- nix-channel --list;
- export NIX_PATH=nixpkgs=/root/.nix-defexpr/channels/nixpkgs
# Install dependencies
- nix-env -iA nixpkgs.bash nixpkgs.git nixpkgs.niv nixpkgs.openssh;
- export NIXPKGS_ALLOW_UNFREE=1;
# QChem configuration for external packages and tuning.
- export NIXQC_SRCURL=http://sol/nix-src
- export NIXQC_AVX=1
# Authenticate runner to allow pushing to the repo
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- git config --global user.email "[email protected]"
- git config --global user.name "sheepforce"
- gitlab_hostname=$(echo "${CI_REPOSITORY_URL}" | sed -e 's|https\?://gitlab-ci-token:.*@||g' | sed -e 's|/.*||g')
- ssh-keyscan "${gitlab_hostname}" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# Build fully with Cabal without nix stuff.
cabalBuild:
image: debian:buster
stage: build
tags:
- largemem
before_script:
# Install dependencies
- apt update && apt install -y curl gcc g++ libgmp-dev libncurses-dev libffi-dev make xz-utils tar perl wget libopenblas-dev
# Install GHC-UP
- mkdir -p $HOME/.cabal/bin $HOME/.ghcup/bin
- export PATH=$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH
- wget https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
- chmod +x x86_64-linux-ghcup && mv x86_64-linux-ghcup $HOME/.ghcup/bin/ghcup
# Install Haskell toolchain
- ghcup upgrade
- ghcup install ghc 8.10.5
- ghcup install cabal
- ghcup set ghc 8.10.5
- cabal update
script:
- cabal build
cache:
paths:
- dist-newstyle
# Quick cabal build, that just should generate the docs.
cabalDocs:
image: debian:buster
stage: docs
before_script:
# Install dependencies
- apt update && apt install -y curl gcc g++ libgmp-dev libncurses-dev libffi-dev make xz-utils tar perl wget libopenblas-dev
# Install GHC-UP
- mkdir -p $HOME/.cabal/bin $HOME/.ghcup/bin
- export PATH=$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH
- wget https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
- chmod +x x86_64-linux-ghcup && mv x86_64-linux-ghcup $HOME/.ghcup/bin/ghcup
# Install Haskell toolchain
- ghcup upgrade
- ghcup install ghc 8.10.5
- ghcup install cabal
- ghcup set ghc 8.10.5
- cabal update
script:
- cabal haddock -f dev
- cp -r $(dirname $(cabal haddock -f dev 2>/dev/null | tail -n 1)) public
- ls -lah public/
artifacts:
paths:
- public
cache:
paths:
- dist-newstyle
# Reproducible nix build with everything pinned and all dependencies build.
nixWrapBuild:
stage: build
tags:
- nix
- turbomole
script:
- nix-build nix/default.nix --arg wrap true -A spicy.components.library
- nix-build nix/default.nix --arg wrap true -A spicy.components.exes
- nix-build nix/default.nix --arg wrap true -A spicy.components.tests
only:
refs:
- master
- release
- merge_requests
# Nix build with Spicy only.
nixBuild:
stage: build
tags:
- nix
- turbomole
script:
- nix-build nix/default.nix --arg wrap false -A spicy.components.library
- nix-build nix/default.nix --arg wrap false -A spicy.components.exes
- nix-build nix/default.nix --arg wrap false -A spicy.components.tests
only:
refs:
- develop
- master
- release
- merge_requests
# A fully static build of spicy. Uses same pins as release build.
nixStaticBuild:
stage: build
tags:
- nix
- turbomole
script:
- cp $(nix-build --arg static true nix/default.nix -A spicy.components.exes)/bin/spicy spicy
artifacts:
when: always
paths:
- spicy
expire_in: 1 year
only:
refs:
- master
- release
- delevop
- merge_requests
# Automatic niv updates and merge requests.
nivUpdate:
stage: update
tags:
- nix
script:
# Make the pr script available
- cp ./.gitlab/createmr.sh /tmp/.
# Perform the update in a new branch and push changes.
- git fetch origin
- url_host=$(echo "${CI_REPOSITORY_URL}" | sed -e 's|https\?://gitlab-ci-token:.*@|ssh://git@|g')
- echo "${url_host}"
- git remote set-url --push origin "${url_host}"
- git checkout develop
- git checkout -b updates/niv
- git pull origin updates/niv || echo "No remote configured yet"
- niv update
- git commit -a -m "niv upstream updates" || echo "Nothing to commit"
- git push -u origin updates/niv
# Make a new merge request
- cp /tmp/createmr.sh ./.gitlab/createmr.sh
- chmod +x ./.gitlab/createmr.sh
- HOST=${CI_PROJECT_URL} CI_PROJECT_ID=${CI_PROJECT_ID} CI_COMMIT_REF_NAME="updates/niv" GITLAB_USER_ID="9271401" PRIVATE_TOKEN=${PRIVATE_TOKEN} ./.gitlab/createmr.sh
rules:
- if: $UPDATE_NIV == "1"