-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
60 lines (53 loc) · 2.51 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
# REF: https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-devices/-/blob/cf3ca7ae/.gitlab-ci.yml
## Docker image: https://hub.docker.com/_/python
image: docker.io/python:3.7
stages:
- linting
- generate_documentation
variables:
# Create a shallow git copy
GIT_DEPTH: 1
.install_prerequesites_pip: &install_prerequesites_pip |
pip install -r .gitlab/requirements.txt
.setup_for_html: &setup_for_html |
apt-get update
apt-get -y install pandoc
linting:
stage: linting
allow_failure: yes
rules:
- if: $CI_MERGE_REQUEST_ID # Execute jobs in merge request context
- if: $CI_COMMIT_BRANCH == 'master' # Execute jobs when a new commit is pushed to master branch
before_script:
- *install_prerequesites_pip
script:
- yamllint devices.yml
pages:
stage: generate_documentation
rules:
- if: $CI_COMMIT_BRANCH == 'master' # Execute jobs when a new commit is pushed to master branch
before_script:
- *install_prerequesites_pip
- *setup_for_html
script:
- ./bin/generate_devices_stats.py
- ./bin/generate_devices_table.py
- ./bin/generate_images_overview.py
- ./bin/generate_images_stats.py
- ./bin/generate_images_table.py
- ./bin/generate_kernel_stats.py
- mkdir -pv ./public/
- cp -v ./.gitlab/404.html ./public/
- cp -v ./.gitlab/public.css ./public/
- pandoc --standalone ./.gitlab/www.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/index.html
- pandoc --standalone ./device-stats.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/device-stats.html
- pandoc --standalone ./devices.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/devices.html
- pandoc --standalone ./image-overview.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/image-overview.html
- pandoc --standalone ./image-stats.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/image-stats.html
- pandoc --standalone ./images.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/images.html
- pandoc --standalone ./kernel-stats.md --css=public.css --include-in-header=./.gitlab/header.html --output=./public/kernel-stats.html
- find public/ -type f -name '*.html' | sort | while read -r x; do sed 's_<table>_<table id="pretty">_' "${x}" > /tmp/out; mv /tmp/out "${x}"; done
artifacts:
paths:
- ./public
expire_in: 1 week