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