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