Skip to content

Commit cf40731

Browse files
committed
Use nix on GitLab CI/CD
1 parent 92e5b7a commit cf40731

File tree

1 file changed

+13
-82
lines changed

1 file changed

+13
-82
lines changed

.gitlab-ci.yml

Lines changed: 13 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,35 @@
11
stages:
2-
- export_org
3-
- build
42
- page_build
53
- page_deploy
64

7-
8-
.build_template: &build_env
9-
image: python:3.12
5+
site:
6+
stage: page_build
7+
image: nixos/nix
108
variables:
11-
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip"
9+
GIT_SUBMODULE_STRATEGY: recursive
1210
cache:
1311
- key:
1412
files:
15-
- pyproject.toml
16-
- setup.py
17-
paths:
18-
- "$PIP_CACHE_DIR"
19-
20-
21-
cpprb_build:
22-
<<: *build_env
23-
stage: build
24-
needs:
25-
- README_MD
13+
- flake.nix
14+
- flake.lock
15+
paths:
16+
- /nix/store
2617
script:
27-
- pip wheel . -w dist --no-deps
18+
- nix build .?submodules=1#site
2819
artifacts:
2920
paths:
30-
- dist/*.whl
31-
- src/cpprb/*.html
32-
33-
emacs:
34-
image: iquiw/alpine-emacs
35-
stage: export_org
36-
script:
37-
- emacs --batch README.org -l site/init.el --eval '(setq debug-on-error t)' --eval '(org-hugo-export-wim-to-md :all-subtrees nil t)'
38-
- emacs --batch CHANGELOG.org -l site/init.el --eval '(org-hugo-export-wim-to-md :all-subtrees nil t)'
39-
- cd site
40-
- emacs --batch site.org -l init.el --eval '(org-hugo-export-wim-to-md :all-subtrees nil t)'
41-
artifacts:
42-
paths:
43-
- site/content
44-
except:
45-
- schedules
46-
47-
README_MD:
48-
image: iquiw/alpine-emacs
49-
stage: export_org
50-
script:
51-
- emacs --batch README.org --eval '(org-md-export-to-markdown)'
52-
artifacts:
53-
paths:
54-
- README.md
55-
except:
56-
- schedules
57-
58-
hugo:
59-
image: registry.gitlab.com/pages/hugo:latest
60-
stage: page_build
61-
variables:
62-
GIT_SUBMODULE_STRATEGY: recursive
63-
environment: production
64-
script:
65-
- hugo version
66-
- cd site
67-
- hugo -c content --logLevel info
68-
artifacts:
69-
paths:
70-
- public
71-
needs:
72-
- emacs
73-
except:
74-
- schedules
75-
76-
sphinx:
77-
<<: *build_env
78-
stage: page_build
79-
environment: production
80-
script:
81-
- pip install $(echo dist/*.whl) "sphinx" "sphinx_rtd_theme" "sphinx-automodapi"
82-
- sphinx-build -b html sphinx public/api
83-
artifacts:
84-
paths:
85-
- sphinx/*.rst
86-
- public
87-
needs:
88-
- cpprb_build
89-
except:
90-
- schedules
21+
- result/public
9122

9223
pages:
9324
image: alpine
9425
stage: page_deploy
9526
environment: production
9627
script:
97-
- echo ''
28+
- mv result/public public
9829
artifacts:
9930
paths:
10031
- public
10132
only:
10233
- master
103-
except:
104-
- schedules
34+
needs:
35+
- site

0 commit comments

Comments
 (0)