ci: add site building and testing
[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
9 check HTML, JS, CSS with eslint and prettier:
10 stage: pre-build
11 image: node
12 cache:
13 paths:
14 - node_modules/
15 script:
16 - yarn install
17 - yarn prettier --check www/
18 - yarn eslint www/
19
20 check HTML, CSS and SVG with html5validator:
21 stage: pre-build
22 image: cyb3rjak3/html5validator:latest
23 script:
24 - html5validator --root www --also-check-css --also-check-svg --show-warnings --log INFO
25
26 build site on Python 3.8:
27 stage: pre-build
28 image: python:3.8-slim-buster
29 before_script:
30 - apt-get update; apt-get install -y make
31 script:
32 - cp -R ./www ./build
33 - misc/collect.py scrape https://downloads.openwrt.org build
34 artifacts:
35 expire_in: 1 week
36 when: always
37 paths:
38 - build
39
40 test site with selenium:
41 stage: test
42 image: selenium/standalone-firefox:latest
43 script:
44 - /opt/bin/entry_point.sh &
45 - sudo apt-get update; sudo apt-get install -y python3-pip python3-pytest
46 - pip3 install selenium-firefox
47 - (cd build; python3 -m http.server &)
48 - pytest-3 tests
49
50 build site for target environment:
51 stage: test
52 image: debian:9
53 before_script:
54 - apt-get update; apt-get install -y make python3
55 script:
56 - cp -R ./www ./build
57 - misc/collect.py scrape https://downloads.openwrt.org build