@@ -50,6 +50,23 @@ commands:
5050 - /home/circleci/.nix-channels
5151 - /home/circleci/.nix-defexpr
5252 - /home/circleci/.config/nix
53+ setup_python :
54+ description : Set up Python
55+ steps :
56+ - run :
57+ name : setup_python
58+ command : |
59+ set -euo pipefail
60+ . /home/circleci/.nix-profile/etc/profile.d/nix.sh
61+ nix-shell shell.nix \
62+ --pure \
63+ --run bash \<<'EOF'
64+ set -euo pipefail
65+
66+ python3 -m venv .python-env
67+ source .python-env/bin/activate
68+ python -m pip install -r requirements.txt
69+ EOF
5370
5471jobs :
5572 build_docs :
@@ -60,11 +77,11 @@ jobs:
6077 steps :
6178 - checkout
6279 - setup_nix
80+ - setup_python
6381 - run :
6482 name : build
6583 command : |
6684 set -euo pipefail
67-
6885 . /home/circleci/.nix-profile/etc/profile.d/nix.sh
6986
7087 mkdir -p /tmp/workspace
7592 --keep ARTIFACTORY_PASSWORD \
7693 --run bash \<<'EOF'
7794 set -euo pipefail
78- docs/download.sh
79- docs/build.sh
80- mv docs/workdir/target/html-docs-*.tar.gz /tmp/workspace/
95+ source .python-env/bin/activate
96+ PATH="$(pwd)/.python-env/bin:$PATH"
97+ prefix=$(jq -r '.prefix' versions.json)
98+ if [[ ${#prefix} -lt 5 ]]; then
99+ echo "Pushhing to $prefix is not currently supported."
100+ exit 1
101+ fi
102+ bin/build
103+ mv workdir/target/html-docs-*.tar.gz /tmp/workspace/
81104 EOF
82105 - store_artifacts :
83106 path : /tmp/workspace
@@ -109,11 +132,16 @@ jobs:
109132 --run bash \<<'EOF'
110133 set -euo pipefail
111134
112- prefix=$(jq -r '.prefix' LATEST)
113- sdk_version=$(jq -r '.daml' LATEST)
135+ prefix=$(jq -r '.prefix' versions.json)
136+ sdk_version=$(jq -r '.daml' versions.json)
137+ if [[ ${#prefix} -lt 5 ]]; then
138+ echo "Pushhing to $prefix is not currently supported."
139+ exit 1
140+ fi
114141
115142 upload=$(mktemp -d)
116143 tar xf /tmp/workspace/html-docs-$sdk_version.tar.gz -C $upload --strip-components=1
144+ aws s3 rm s3://docs-daml-com/$prefix --recursive --region us-east-1
117145 aws s3 cp $upload s3://docs-daml-com/$prefix --recursive --acl public-read --region us-east-1
118146 aws cloudfront create-invalidation --distribution-id E1U753I56ERH55 --paths "/$prefix/*"
119147 EOF
@@ -126,6 +154,7 @@ jobs:
126154 steps :
127155 - checkout
128156 - setup_nix
157+ - setup_python
129158 - run :
130159 name : push
131160 command : |
@@ -141,6 +170,8 @@ jobs:
141170 --keep AWS_SECRET_ACCESS_KEY \
142171 --run bash \<<'EOF'
143172 set -euo pipefail
173+ source .python-env/bin/activate
174+ PATH="$(pwd)/.python-env/bin:$PATH"
144175
145176 snapshots=$(curl -sf https://docs.daml.com/snapshots.json \
146177 | jq -r '
@@ -189,7 +220,8 @@ jobs:
189220 if curl -Ifs https://docs.daml.com/$version/index.html &> /dev/null
190221 then echo "-> Nothing to do."
191222 elif [ "$version" = "2.0.1-snapshot.20220419.9374.0.44df8f12" ] \
192- || [ "$version" = "2.1.0-snapshot.20220411.9707.0.f6fed6ea" ]
223+ || [ "$version" = "2.1.0-snapshot.20220411.9707.0.f6fed6ea" ] \
224+ || [ "$version" = "2.5.0-snapshot.20221010.10736.0.2f453a14" ]
193225 then echo "-> Skipping, known broken."
194226 else
195227 echo "-> Getting Canton version"
@@ -203,20 +235,21 @@ jobs:
203235 | grep canton \
204236 | head -1 \
205237 | sed 's/canton-open-source-\(.*\)\.tar\.gz/\1/')
206- echo "-> Building daml $version with canton $canton."
238+ finance=$(git show origin/main:versions.json | jq -r '.daml_finance')
239+ echo "-> Building daml $version with canton $canton & finance $finance."
207240 jq -n \
208241 --arg daml $version \
209242 --arg canton $canton \
210- '{daml: $daml, canton: $canton, prefix: $daml}' \
211- > LATEST
243+ --arg finance $finance \
244+ '{daml: $daml, canton: $canton, prefix: $daml, daml_finance: $finance}' \
245+ > versions.json
212246
213- docs/download.sh
214- docs /build.sh
247+ bin/clean
248+ bin /build
215249 upload=$(mktemp -d)
216- tar xf docs/ workdir/target/html-docs-$version.tar.gz -C $upload --strip-components=1
250+ tar xf workdir/target/html-docs-$version.tar.gz -C $upload --strip-components=1
217251 aws s3 cp $upload s3://docs-daml-com/$version --recursive --acl public-read --region us-east-1
218252 aws cloudfront create-invalidation --distribution-id E1U753I56ERH55 --paths "/$version/*"
219- rm -rf docs/workdir
220253 echo "-> Done."
221254 fi
222255 echo
0 commit comments