Fix building and publishing of the website assets (#620)

This commit is contained in:
Louis Gesbert 2024-05-15 13:05:31 +02:00 committed by GitHub
commit fcb6829227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View File

@ -137,6 +137,14 @@ jobs:
cd ~/french-law cd ~/french-law
opam --cli=2.1 exec -- make dependencies-ocaml dependencies-js dependencies-python opam --cli=2.1 exec -- make dependencies-ocaml dependencies-js dependencies-python
opam --cli=2.1 exec -- make bench_ocaml bench_js bench_python opam --cli=2.1 exec -- make bench_ocaml bench_js bench_python
- name: Pack website assets
run: >-
tar cz -hf website-assets.tar.gz
-C ~/catala-examples/_build/default/tutorial_en/ tutorial_en.html
-C ~/catala-examples/_build/default/tutoriel_fr/ tutoriel_fr.html
-C ~/catala-examples/_build/default/us_tax_code/ us_tax_code.html
-C ~/catala-examples/_build/default/allocations_familiales/ Allocations_familiales.html Allocations_familiales_schema.json
-C ~/catala-examples/_build/default/aides_logement/ Aides_logement.html Aides_logement_schema.json
- name: Gather all artifacts - name: Gather all artifacts
run: | run: |
cd cd
@ -148,6 +156,7 @@ jobs:
tar cz -hf "artifacts/french-law_ocaml.tar.gz" -C french-law/_build/install/default/lib french-law tar cz -hf "artifacts/french-law_ocaml.tar.gz" -C french-law/_build/install/default/lib french-law
cp catala-examples/_build/french-law_npm.tar.gz artifacts/ cp catala-examples/_build/french-law_npm.tar.gz artifacts/
cp catala-examples/_build/french_law_python.tar.gz artifacts/ cp catala-examples/_build/french_law_python.tar.gz artifacts/
mv website-assets.tar.gz artifacts/
- name: Upload artifacts - name: Upload artifacts
continue-on-error: true continue-on-error: true
# Uploading artifacts works but then return failure with: # Uploading artifacts works but then return failure with:

View File

@ -245,9 +245,11 @@ tests/%: .FORCE
# Note: these are already built by the @doc dune alias # Note: these are already built by the @doc dune alias
# (and therefore the doc target here) # (and therefore the doc target here)
WEBSITE_ASSETS = grammar.html catala.html clerk.html WEBSITE_ASSETS_LOCAL_BASE = grammar.html catala.html clerk.html
WEBSITE_ASSETS_EXAMPLES = \ WEBSITE_ASSETS_LOCAL = $(addprefix _build/default/,$(WEBSITE_ASSETS_BASE))
WEBSITE_ASSETS_EXAMPLES_BASE = \
tutorial_en/tutorial_en.html \ tutorial_en/tutorial_en.html \
tutoriel_fr/tutoriel_fr.html \ tutoriel_fr/tutoriel_fr.html \
us_tax_code/us_tax_code.html \ us_tax_code/us_tax_code.html \
@ -256,19 +258,22 @@ WEBSITE_ASSETS_EXAMPLES = \
aides_logement/Aides_logement.html \ aides_logement/Aides_logement.html \
aides_logement/Aides_logement_schema.json aides_logement/Aides_logement_schema.json
WEBSITE_ASSETS_ALL = $(WEBSITE_ASSETS) $(addprefix catala-examples.tmp/,$(WEBSITE_ASSETS_EXAMPLES)) WEBSITE_ASSETS_EXAMPLES = \
$(addprefix _build/default/,$(WEBSITE_ASSETS_EXAMPLES_BASE))
website-assets-base: build $(WEBSITE_ASSETS_LOCAL): build
dune build $(WEBSITE_ASSETS)
$(WEBSITE_ASSETS_EXAMPLES):
$(call local_tmp_clone,catala-examples) && \ $(call local_tmp_clone,catala-examples) && \
$(MAKE) -C catala-examples.tmp \ $(MAKE) -C catala-examples.tmp \
CATALA=../$(CATALA_BIN) \ CATALA=../$(CATALA_BIN) \
CLERK=../$(CLERK_BIN) \ CLERK=../$(CLERK_BIN) \
BUILD=../_build/default \ BUILD=../_build/default \
$(addprefix ../_build/default/,$(WEBSITE_ASSETS_EXAMPLES)) $(addprefix ../,$(WEBSITE_ASSETS_EXAMPLES))
dune build $(addprefix _build/default/,$(WEBSITE_ASSETS_ALL)) $(WEBSITE_ASSETS)
website-assets.tar: website-assets-base website-assets.tar: $(WEBSITE_ASSETS_LOCAL) $(WEBSITE_ASSETS_EXAMPLES)
tar cf $@ $(foreach file,$(WEBSITE_ASSETS_ALL),-C $(CURDIR)/$(dir _build/default/$(file)) $(notdir $(file))) tar cf $@ $(foreach file,$^,-C $(CURDIR)/$(dir $(file)) $(notdir $(file)))
#> website-assets : Builds all the assets necessary for the Catala website #> website-assets : Builds all the assets necessary for the Catala website
website-assets: website-assets.tar website-assets: website-assets.tar