ci: remove superfluous before_script
[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 git
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 - sed -i "s;%GIT_VERSION%;$(git describe --tags);" build/index.html
67 - misc/collect.py scrape https://downloads.openwrt.org build
68
69 build site for target environment using scan method:
70 extends: .build site
71 script:
72 - cp -R ./www ./build
73 - sed -i "s;%GIT_VERSION%;$(git describe --tags);" build/index.html
74 - misc/collect.py scan downloads.openwrt.org tests/profiles build
75
76 .test site:
77 stage: test
78 image: selenium/standalone-firefox:latest
79 script:
80 - /opt/bin/entry_point.sh &
81 - sudo apt-get update; sudo apt-get install -y python3-pip python3-pytest
82 - pip3 install selenium-firefox
83 - (cd build; python3 -m http.server &)
84 - pytest-3 tests
85
86 test scraped site with selenium:
87 extends: .test site
88 dependencies:
89 - build site for target environment using scrape method
90
91 test scaned site with selenium:
92 extends: .test site
93 dependencies:
94 - build site for target environment using scan method
95
96 .deploy:
97 stage: deploy
98 image: alpine
99 dependencies:
100 - build site for target environment using scrape method
101 before_script:
102 - apk update && apk add rsync
103 only:
104 - master
105 - tags
106 script:
107 - rsync -rlptvz build/ "rsync://firmware_selector@mirror-02.infra.openwrt.org/$RSYNC_TARGET/www/"
108
109 deploy to firmware-selector.staging.openwrt.org:
110 extends: .deploy
111 variables:
112 RSYNC_TARGET: firmware-selector-staging-upload
113
114 deploy to firmware-selector.openwrt.org:
115 extends: .deploy
116 variables:
117 RSYNC_TARGET: firmware-selector-upload
118 when: manual
119 only:
120 - tags