]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - .gitlab-ci.yml
pipeline: optimise builds and stop ASAP if any fail
[xonotic/xonotic-data.pk3dir.git] / .gitlab-ci.yml
1 workflow:\r
2   rules:\r
3     - if: $CI_COMMIT_MESSAGE =~ /Transifex autosync/\r
4       when: never\r
5     - when: always\r
6 \r
7 before_script:\r
8   - ln -s $PWD data/xonotic-data.pk3dir\r
9 \r
10   - export MAKEFLAGS=-j$(nproc); echo MAKEFLAGS=$MAKEFLAGS\r
11 #   FIXME: -march=native -mtune=native _changes the hash_, why?!?\r
12 # - export CC="gcc -pipe -march=native -mtune=native"\r
13   - export CC="gcc -pipe"\r
14 \r
15   - git clone --depth=1 --branch=main https://gitlab.com/xonotic/gmqcc.git gmqcc\r
16   - make -C gmqcc || exit 1\r
17   - export QCC="$PWD/gmqcc/gmqcc"\r
18 \r
19 test_compilation_units:\r
20   rules:\r
21     - changes:\r
22       - qcsrc/**/*\r
23   stage: test\r
24   script:\r
25     - ./qcsrc/tools/compilationunits.sh\r
26 \r
27 test_sv_game:\r
28   stage: test\r
29   script:\r
30     - git clone --depth=1 --branch=div0-stable https://gitlab.com/xonotic/darkplaces.git darkplaces\r
31     - make -C darkplaces sv-release || exit 1\r
32     - export ENGINE="$PWD/darkplaces/darkplaces-dedicated -xonotic -noconfig -nohome"\r
33     - make qc || exit 1\r
34 \r
35     - mkdir -p data/maps\r
36     - wget -O data/stormkeep.pk3 http://beta.xonotic.org/autobuild-bsp/latest/stormkeep.pk3\r
37     - wget -O data/maps/stormkeep.mapinfo https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.mapinfo\r
38     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints\r
39     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache\r
40 \r
41     - ${ENGINE} +map stormkeep +dumpnotifs +wait +quit\r
42     - diff notifications.cfg data/data/notifications_dump.cfg ||\r
43         { echo 'Please update notifications.cfg using `dumpnotifs`!'; exit 1; }\r
44 \r
45     - EXPECT=d4060caf37a2e60bab68d1f83bc57368\r
46     - HASH=$(${ENGINE} +timestamps 1 +exec serverbench.cfg\r
47       | tee /dev/stderr\r
48       | sed -e 's,^\[[^]]*\] ,,'\r
49       | grep '^:'\r
50       | grep -v '^:gamestart:'\r
51       | grep -v '^:anticheat:'\r
52       | md5sum | awk '{ print $1 }')\r
53     - echo 'expected:' $EXPECT\r
54     - echo '  actual:' $HASH\r
55     - test "$HASH" == "$EXPECT"\r
56     - exit $?\r
57 \r
58 test_sv_unit:\r
59   stage: test\r
60   script:\r
61     - git clone --depth=1 --branch=div0-stable https://gitlab.com/xonotic/darkplaces.git darkplaces\r
62     - cd darkplaces && make sv-release || exit 1\r
63     - export ENGINE="$PWD/darkplaces-dedicated -xonotic" && cd ..\r
64     - make qc || exit 1\r
65 \r
66     - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp\r
67     - while read line; do\r
68         echo $line;\r
69         if [[ $line == "All tests OK" ]]; then exit 0; fi;\r
70       done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)\r
71     - exit 1\r
72 \r
73 # NOTE: The generated docs are incomplete - they don't contain code behind SVQC CSQC MENUQC GAMEQC ifdefs.\r
74 # With them added to PREDEFINED, it would take over half an hour to generate the docs and even then\r
75 # they might not be complete. Doxygen doesn't handle #elif and might not understand some QC definitions.\r
76 #doxygen:  # rename to 'pages' when gitlab.com allows pages to exceed 100MiB\r
77 #  before_script:\r
78 #    - ln -s $PWD data/xonotic-data.pk3dir # is this needed?\r
79 #    - apt-get update\r
80 #    - apt-get -y install doxygen graphviz\r
81 #  stage: deploy\r
82 #  script:\r
83 #    - cd qcsrc && doxygen\r
84 #    - mv html ../public\r
85 #    - mkdir -p ~/.ssh\r
86 #    - for i in {0..0}; do eval $(printf "echo \$id_rsa_%02d\n" $i) >> ~/.ssh/id_rsa_base64; done\r
87 #    - base64 --decode ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa\r
88 #    - chmod 600 ~/.ssh/id_rsa\r
89 #    - echo -e "Host *\n\tStrictHostKeyChecking no\n\tLogLevel ERROR\n" >> ~/.ssh/config\r
90 #    - git config --global user.name "Gitlab CI"\r
91 #    - git config --global user.email "<>"\r
92 #    - git clone --single-branch --depth 1 ${DEPLOY_HOST}:${DEPLOY_REPO} ~/deploy_\r
93 #    - mkdir ~/deploy && mv ~/deploy_/.git ~/deploy && rm -r ~/deploy_\r
94 #    - cp -r ../public/* ~/deploy\r
95 #    - cd ~/deploy && git add -A . && git commit -m "Deploy ${CI_BUILD_REF}" && git push origin gh-pages\r
96 #  artifacts:\r
97 #    paths:\r
98 #      - public\r
99 #  only:\r
100 #    - master\r