]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - .gitlab-ci.yml
905853d3fbc380d8aee7cd9aac79447952ca1360
[xonotic/xonotic-data.pk3dir.git] / .gitlab-ci.yml
1 before_script:
2   - ln -s $PWD data/xonotic-data.pk3dir
3
4   - git clone --depth=1 --branch=master https://gitlab.com/xonotic/gmqcc.git gmqcc
5   - cd gmqcc && make -j $(nproc) && export QCC="$PWD/gmqcc"
6   - cd ..
7
8 report_cloc:
9   stage: test
10   script:
11     - cloc --force-lang-def=qcsrc/tools/cloc.txt --sql 1 --sql-project xonotic qcsrc | sqlite3 code.db
12     - sqlite3 code.db 'select file,nCode from t where nCode > 1000 order by nBlank+nComment+nCode desc'
13
14 test_compilation_units:
15   stage: test
16   script:
17     - ./qcsrc/tools/compilationunits.sh
18
19 test_sv_game:
20   stage: test
21   script:
22     - git clone --depth=1 --branch=div0-stable https://gitlab.com/xonotic/darkplaces.git darkplaces
23     - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
24     - cd ..
25
26     - mkdir -p data/maps
27     - wget -O data/stormkeep.pk3 http://beta.xonotic.org/autobuild-bsp/latest/stormkeep.pk3
28     - wget -O data/maps/stormkeep.mapinfo https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.mapinfo
29     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
30     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
31     - make
32     - EXPECT=a0397fc196d6e249ecda448bcc47a5ab
33     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
34       | tee /dev/stderr
35       | grep '^:'
36       | grep -v '^:gamestart:'
37       | grep -v '^:anticheat:'
38       | md5sum | awk '{ print $1 }')
39     - echo 'expected:' $EXPECT
40     - echo '  actual:' $HASH
41     - test "$HASH" == "$EXPECT"
42     - exit $?
43
44 test_sv_unit:
45   stage: test
46   script:
47     - git clone --depth=1 --branch=div0-stable https://gitlab.com/xonotic/darkplaces.git darkplaces
48     - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
49     - cd ..
50
51     - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
52     - make
53     - while read line; do
54         echo $line;
55         if [[ $line == "All tests OK" ]]; then exit 0; fi;
56       done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
57     - exit 1
58
59 doxygen:  # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
60   stage: deploy
61   script:
62     - cd qcsrc && doxygen
63     - mv html ../public
64     - for i in {0..0}; do eval $(printf "echo \$id_rsa_%02d\n" $i) >> ~/.ssh/id_rsa_base64; done
65     - base64 --decode ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
66     - chmod 600 ~/.ssh/id_rsa
67     - echo -e "Host *\n\tStrictHostKeyChecking no\n\tLogLevel ERROR\n" >> ~/.ssh/config
68     - git config --global user.name "Gitlab CI"
69     - git config --global user.email "<>"
70     - git clone --single-branch --depth 1 ${DEPLOY_HOST}:${DEPLOY_REPO} ~/deploy_
71     - mkdir ~/deploy && mv ~/deploy_/.git ~/deploy && rm -r ~/deploy_
72     - cp -r ../public/* ~/deploy
73     - cd ~/deploy && git add -A . && git commit -m "Deploy ${CI_BUILD_REF}" && git push origin gh-pages
74   artifacts:
75     paths:
76       - public
77   only:
78     - master