Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,35 @@ jobs:
key: dvc-cache-${{ hashFiles('.github/workflows/build.yaml', 'text/dvc.lock', 'text/dvc.yaml', 'text/specs.py', 'ModelicaByExample/**/*.mo') }}
restore-keys: |
dvc-cache-
- name: Restore Sphinx Build Cache
id: sphinx-cache-restore
uses: actions/cache/restore@v4
with:
path: text/build
key: sphinx-build-${{ hashFiles('.github/workflows/build.yaml', 'text/source/**', 'text/locale/kr/**', 'text/Makefile') }}
restore-keys: |
sphinx-build-
- name: Restore CI Deps Cache (DVC outputs + plots)
id: cideps-cache-restore
uses: actions/cache/restore@v4
with:
path: |
text/results
text/plots
text/docs-dir
key: ci-deps-${{ hashFiles('.github/workflows/build.yaml', 'text/dvc.lock', 'text/dvc.yaml', 'text/specs.py', 'ModelicaByExample/**/*.mo') }}
- name: Make PDFs
env:
CI_BUILD: ${{ steps.cideps-cache-restore.outputs.cache-hit == 'true' && '1' || '0' }}
run: make env pdfs
- name: Upload Executables
uses: actions/upload-artifact@v4
with:
name: exes.tar.gz
path: text/results/exes.tar.gz
- name: Generate JSON
env:
CI_BUILD: ${{ steps.cideps-cache-restore.outputs.cache-hit == 'true' && '1' || '0' }}
run: make env json
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
Expand All @@ -46,6 +67,23 @@ jobs:
with:
path: .dvc/cache
key: ${{ steps.dvc-cache-restore.outputs.cache-primary-key }}
- name: Save Sphinx Build Cache
id: sphinx-cache-save
if: always() && steps.sphinx-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: text/build
key: ${{ steps.sphinx-cache-restore.outputs.cache-primary-key }}
- name: Save CI Deps Cache
id: cideps-cache-save
if: always() && steps.cideps-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
text/results
text/plots
text/docs-dir
key: ${{ steps.cideps-cache-restore.outputs.cache-primary-key }}
generate_site:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'Full Build')
runs-on: ubuntu-latest
Expand Down
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,39 @@

.PHONY: specs results dirhtml ebooks api publish_server publish_web serve

# When CI_BUILD=1, the json/dirhtml/pdfs targets skip the specs+results
# (DVC repro) dependency chain and assume text/results, text/plots, and
# text/docs-dir are already populated (e.g. restored from cache in CI).
# text/Makefile already has matching CI_BUILD support that drops the same
# deps from its sphinx targets. Default (CI_BUILD=0) preserves the old
# behavior so local builds work unchanged.
CI_BUILD ?= 0
ifeq ($(CI_BUILD),1)
SPHINX_DEPS =
else
SPHINX_DEPS = results
endif

all: specs results json ebooks pdfs

env:
dvc cache dir .dvc/cache
-mkdir .dvc/cache
uname -m > text/build-arch
-rm -rf "$(HOME)/.openmodelica/libraries/ModelicaByExample 0.6.0"
-rm -rf "$(HOME)/.openmodelica/libraries/ModelicaByExample 0.6.0"
mkdir -p $(HOME)/.openmodelica/libraries
ln -s $(PWD)/ModelicaByExample "$(HOME)/.openmodelica/libraries/ModelicaByExample 0.6.0"
ln -s $(PWD)/ModelicaByExample "$(HOME)/.openmodelica/libraries/ModelicaByExample 0.6.0"

specs:
(cd text; make specs)

results: env specs
(cd text; make results)

dirhtml:
dirhtml: $(SPHINX_DEPS)
(cd text; make dirhtml)

json: results
json: $(SPHINX_DEPS)
(cd text; make json json_kr)

ebooks:
Expand Down
7 changes: 5 additions & 2 deletions text/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ SET_BOOK_LANG_KR = BOOK_LANG=kr

# For CI we don't want to rebuild the whole dependencies each time.
# To enable the CI build do, e.g., `make CI_BUILD=1 pdf`
CI_BUILD=0
CI_BUILD ?= 0
# CI_BUILD=1 skips the expensive simulation (specs+results=dvc repro) but
# still runs 'images' because svg->pdf conversion is fast and the converted
# PDFs aren't checked in (the latex builder needs them).
ifeq ($(CI_BUILD),1)
SPHINXDEPS =
SPHINXDEPS = images
else
SPHINXDEPS = specs results images
endif
Expand Down
Loading