aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: f3572f2084c46894556420490f75680633f3a98e (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CI Build

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  formatting-check:
    name: formatting-check
    runs-on: ubuntu-latest
    steps:
     - uses: actions/checkout@v4
     - name: Run clang-format style check for C++
       uses: jidicula/clang-format-action@v4.12.0
       with:
         clang-format-version: '17'
         check-path: 'src'
         fallback-style: LLVM

  build-windows:
    needs: formatting-check
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@master
        with:
          submodules: recursive
      
      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          version: 6.5.3
          target: desktop
          arch: win64_msvc2019_64
          cache: true
          cache-key-prefix: install-qt-action
          modules: 'qtimageformats qtwebsockets'

      - name: Configure MSVC (Windows)
        uses: ilammy/msvc-dev-cmd@v1

      - name: Install Windows Discord RPC
        shell: bash
        run: |
          curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-win.zip -o discord_rpc.zip
          unzip discord_rpc.zip
          cp ./discord-rpc/win64-dynamic/lib/discord-rpc.lib ./lib/
          cp ./discord-rpc/win64-dynamic/bin/discord-rpc.dll ./bin/
          cp ./discord-rpc/win64-dynamic/include/discord*.h ./lib/
          
      - name: Install Windows BASS
        shell: bash
        run: |
          curl http://www.un4seen.com/files/bass24.zip -o bass.zip
          unzip -d bass -o bass.zip
          cp ./bass/c/bass.h ./lib
          cp ./bass/c/x64/bass.lib ./lib/
          cp ./bass/x64/bass.dll ./bin/

          curl http://www.un4seen.com/files/bassmidi24.zip -o bassmidi.zip
          unzip -d bass -o bassmidi.zip
          cp ./bass/c/bassmidi.h ./lib
          cp ./bass/c/x64/bassmidi.lib ./lib/
          cp ./bass/x64/bassmidi.dll ./bin/

          curl http://www.un4seen.com/files/bassopus24.zip -o bassopus.zip
          unzip -d bass -o bassopus.zip
          cp ./bass/c/bassopus.h ./lib
          cp ./bass/c/x64/bassopus.lib ./lib/
          cp ./bass/x64/bassopus.dll ./bin/

      - name: Clone Apng plugin
        uses: actions/checkout@master
        with:
          repository: jurplel/QtApng
          path: ./qtapng

      - name: Build Apng plugin
        run: |
          cd ./qtapng
          cmake .
          cmake --build . --config Release

      - name: Build
        run: |
          cmake .
          cmake --build . --config Release

      - name: Deploy Windows
        working-directory: ${{github.workspace}}/bin/
        shell: bash
        run: |
          windeployqt --no-quick-import --no-translations --no-compiler-runtime --no-opengl-sw ./Attorney_Online.exe

      - name: Clone Themes
        uses: actions/checkout@master
        with:
          repository: AttorneyOnline/AO2-Themes
          path: "bin/themes"

      - name: Upload Artifact
        uses: actions/upload-artifact@master
        with:
          name: Attorney_Online-Windows
          path: ${{github.workspace}}/bin
  
  build-linux:
    needs: formatting-check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
        with:
          submodules: recursive

      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          aqtversion: '==3.1.*'
          version: '6.5.3'
          host: 'linux'
          target: 'desktop'
          arch: 'gcc_64'
          cache: true
          cache-key-prefix: install-qt-action
          modules: 'qtimageformats qtwebsockets'

      - name: Install Linux Discord RPC
        run: |
          curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc.zip
          unzip discord_rpc.zip
          cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./lib/
          cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./bin/
          cp ./discord-rpc/linux-dynamic/include/discord*.h ./src/

      - name: Install Linux BASS
        run: |
          curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip
          unzip -d bass -o bass.zip
          cp ./bass/bass.h ./lib
          cp ./bass/libs/x86_64/libbass.so ./lib/
          cp ./bass/libs/x86_64/libbass.so ./bin/

          curl http://www.un4seen.com/files/bassmidi24-linux.zip -o bassmidi.zip
          unzip -d bass -o bassmidi.zip
          cp ./bass/bassmidi.h ./lib
          cp ./bass/libs/x86_64/libbassmidi.so ./lib/
          cp ./bass/libs/x86_64/libbassmidi.so ./bin/

          curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip
          unzip -d bass -o bassopus.zip
          cp ./bass/bassopus.h ./lib
          cp ./bass/libs/x86_64/libbassopus.so ./lib/
          cp ./bass/libs/x86_64/libbassopus.so ./bin/

      - name: Clone Apng plugin
        uses: actions/checkout@master
        with:
          repository: jurplel/QtApng
          path: ./qtapng

      - name: Build Apng plugin
        run: |
          cd ./qtapng
          cmake . -D CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE="${{ github.workspace }}/bin/imageformats/"
          cmake --build . --config Release

      - name: Build
        run: |
          cmake .
          cmake --build . --config Release

      - name: Deploy Linux
        shell: bash
        run: |
          cd ${{ github.workspace }}/bin
          mkdir ./imageformats
          cp ../qtapng/plugins/imageformats/libqapng.so ./imageformats
          cp ../scripts/launch.sh .
          chmod +x launch.sh
          chmod +x Attorney_Online

      - name: Clone Themes
        uses: actions/checkout@master
        with:
          repository: AttorneyOnline/AO2-Themes
          path: "bin/themes"

      - name: Upload Artifact
        uses: actions/upload-artifact@master
        with:
          name: Attorney_Online-Linux
          path: ${{github.workspace}}/bin