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