www/index.html: add proper project URL and add version variable
[web/firmware-selector-openwrt-org.git] / .gitlab-ci.yml
1 include:
2 - local: '.gitlab/ci/prebuild.yml'
3 - remote: https://gitlab.com/ynezz/openwrt-ci/raw/master/openwrt-ci/gitlab/main.yml
4
5 stages:
6 - pre-build
7 - test
8 - deploy
9
10 check HTML, JS, CSS with eslint and prettier:
11 stage: pre-build
12 image: node
13 cache:
14 paths:
15 - node_modules/
16 script:
17 - yarn install
18 - yarn prettier --check www/
19 - yarn eslint www/
20
21 check HTML, CSS and SVG with html5validator:
22 stage: pre-build
23 image: cyb3rjak3/html5validator:latest
24 script:
25 - html5validator --root www --also-check-css --show-warnings --log INFO
26
27 .build python:
28 stage: pre-build
29 image: python:$CI_PYTHON_VERSION-slim-buster
30 before_script:
31 - apt-get update; apt-get install -y make
32 script:
33 - cp -R ./www ./build
34 - misc/collect.py scrape https://downloads.openwrt.org build
35 artifacts:
36 expire_in: 1 week
37 when: always
38 paths:
39 - build
40
41 build site on Python 3.6:
42 extends: .build python
43 variables:
44 CI_PYTHON_VERSION: "3.6"
45
46 build site on Python 3.8:
47 extends: .build python
48 variables:
49 CI_PYTHON_VERSION: "3.8"
50
51 .build site:
52 stage: pre-build
53 image: debian:9
54 before_script:
55 - apt-get update; apt-get install -y make python3 ca-certificates
56 artifacts:
57 expire_in: 1 week
58 when: always
59 paths:
60 - build
61
62 build site for target environment using scrape method:
63 extends: .build site
64 script:
65 - cp -R ./www ./build
66 - misc/collect.py scrape https://downloads.openwrt.org build
67
68 build site for target environment using scan method:
69 extends: .build site
70 script:
71 - cp -R ./www ./build
72 - misc/collect.py scan downloads.openwrt.org tests/profiles build
73
74 .test site:
75 stage: test
76 image: selenium/standalone-firefox:latest
77 script:
78 - /opt/bin/entry_point.sh &
79 - sudo apt-get update; sudo apt-get install -y python3-pip python3-pytest
80 - pip3 install selenium-firefox
81 - (cd build; python3 -m http.server &)
82 - pytest-3 tests
83
84 test scraped site with selenium:
85 extends: .test site
86 dependencies:
87 - build site for target environment using scrape method
88
89 test scaned site with selenium:
90 extends: .test site
91 dependencies:
92 - build site for target environment using scan method
93
94 .deploy:
95 stage: deploy
96 image: alpine
97 dependencies:
98 - build site for target environment using scrape method
99 before_script:
100 - apk update && apk add rsync
101 only:
102 - master
103 script:
104 - rsync -rlptvz build/ "rsync://firmware_selector@mirror-02.infra.openwrt.org/$RSYNC_TARGET/www/"
105
106 deploy to firmware-selector.staging.openwrt.org:
107 extends: .deploy
108 variables:
109 RSYNC_TARGET: firmware-selector-staging-upload
110
111 deploy to firmware-selector.openwrt.org:
112 extends: .deploy
113 variables:
114 RSYNC_TARGET: firmware-selector-upload
115 when: manual
116 before_script:
117 - apk update && apk add rsync