aboutsummaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 8efe1547aaf1d38d80cc32e6153d03dab2f73718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
  - lib/

before_script:
  - echo Current working directory is $(pwd)

build linux x86_64:
  image: ubuntu
  stage: build
  tags:
    - docker
    - linux
  script:
    - apt-get install --no-install-recommends -y qt5-default clang make git upx unzip
    - qmake --version
    - clang --version

    - cd scripts
    - ./configure_ubuntu.sh
    - cd ..

    - qmake
    - make -j4
    - upx --lzma -9 --force bin/Attorney_Online
  artifacts:
    paths:
      - bin/

build windows i686:
  image: ${CI_REGISTRY_IMAGE}/builder-windows-i686
  stage: build
  tags:
    - docker
    - linux
  script:
    # Extract BASS
    - mkdir bass
    - cd bass
    - curl http://www.un4seen.com/files/bass24.zip -o bass.zip
    - unzip bass.zip
    - cp bass.dll ../lib
    - cd ..

    # Build
    - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake
    - make -j4

    # Post-processing
    - upx --lzma -9 --force bin/Attorney_Online.exe
  artifacts:
    paths:
      - bin/

# Base folder
.deploy_base: &deploy_base |
    mkdir base
    mkdir base/themes
    cp -a ../base/themes/default base/themes/
    cp -a ../base/config.ini base/config.sample.ini
    cp -a ../base/serverlist.txt base/serverlist.sample.txt
  
# Miscellaneous files
.deploy_misc: &deploy_misc |
    cp -a ../README.md README.md.txt
    cp -a ../LICENSE.MIT LICENSE.txt

deploy linux:
  stage: deploy
  dependencies:
    - build linux x86_64
  tags:
    - docker
    - linux
  script:
    - mkdir artifact
    - cd artifact
    - *deploy_base
    - *deploy_misc

    # Platform-specific
    - cp -a ../lib/*.so .
    - cp -a ../bin/Attorney_Online .
    - echo "#!/bin/sh" >> ./run.sh
    - echo "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh
    - chmod +x ./run.sh

    # Zipping
    # zip -r -9 -l Attorney_Online_$(git describe --tags)_linux_x86_64.zip .
    - mkdir ../zip
    - tar cavf ../zip/Attorney_Online_$(git describe --tags)_x64.tar.xz *
    - sha1sum ../zip/*
  artifacts:
    paths:
      - zip/

deploy windows:
  image: ubuntu
  stage: deploy
  dependencies:
    - build windows i686
  tags:
    - docker
    - linux
  script:
    - apt-get update
    - apt-get install --no-install-recommends -y zip git

    - mkdir artifact
    - cd artifact
    - *deploy_base
    - *deploy_misc

    # Platform-specific
    - cp -a ../lib/*.dll .
    - cp -a ../bin/Attorney_Online.exe .

    # Zipping
    # -r: recursive; -9: max compression; -l: convert to CR LF
    - mkdir ../zip
    - zip -r -9 -l ../zip/Attorney_Online_$(git describe --tags)_windows_i386.zip .
    - sha1sum ../zip/*
  artifacts:
    paths:
      - zip/