Skip to content

Commit 65ccebe

Browse files
committed
refactor build and CI
1 parent ff14375 commit 65ccebe

15 files changed

Lines changed: 312 additions & 240 deletions

File tree

.github/workflows/build.yml

Lines changed: 46 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,68 @@
1-
name: Build
2-
on:
3-
push:
4-
branches:
5-
- main
6-
- new-mod-api
1+
name: Build and Deploy
2+
on: [push, pull_request]
73

84
jobs:
95
android:
106
name: Android
117
runs-on: ubuntu-latest
128
steps:
139
- name: Checkout sources
14-
uses: actions/checkout@v4
10+
uses: actions/checkout@v5
1511
with:
1612
fetch-depth: 0
1713
submodules: recursive
18-
- name: Fetch YaPB Graphs from DB
19-
run: scripts/yapb_graph_dl.sh
2014
- name: Setup Java
2115
uses: actions/setup-java@v4
2216
with:
2317
java-version: 17
2418
distribution: 'temurin'
2519
cache: gradle
26-
- name: Setup Android SDK
27-
uses: android-actions/setup-android@v3
28-
- name: Build
29-
run: ./gradlew assembleCi
30-
working-directory: android
31-
- name: Sign APK
32-
uses: r0adkll/sign-android-release@v1
33-
with:
34-
releaseDirectory: android/app/build/outputs/apk/ci
35-
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
36-
alias: ${{ secrets.ALIAS }}
37-
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
38-
keyPassword: ${{ secrets.KEY_PASSWORD }}
20+
- name: Build and Sign APK
3921
env:
40-
BUILD_TOOLS_VERSION: "34.0.0"
22+
KEYSTORE_FILE_PATH: ${{ github.workspace }}/signingkey.jks
23+
KEYSTORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
24+
KEY_ALIAS: ${{ secrets.ALIAS }}
25+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
26+
run: |
27+
echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > ${{ env.KEYSTORE_FILE_PATH }}
28+
./gradlew assembleGitContinuous
29+
mv app/build/outputs/apk/git/continuous/app-git-continuous.apk CS16Client-Android.apk
30+
working-directory: android
4131
- name: Upload artifacts
4232
uses: actions/upload-artifact@v4
4333
with:
4434
name: Android
45-
path: android/app/build/outputs/apk/ci/app-ci-unsigned-signed.apk
35+
path: android/CS16Client-Android.apk
4636
psvita:
4737
name: PS Vita
4838
runs-on: ubuntu-latest
4939
steps:
5040
- name: Checkout sources
51-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
5242
with:
5343
fetch-depth: 0
5444
submodules: recursive
5545
- name: Install dependencies
5646
run: |
5747
sudo apt-get update
5848
sudo apt-get install libatomic1 libgcc-s1 \
59-
libstdc++6 gcc-multilib g++-multilib cmake \
49+
libstdc++6 gcc-multilib g++-multilib \
6050
ninja-build libfontconfig-dev
6151
- name: Setup VitaSDK
6252
run: |
63-
chmod +x scripts/psvita_sdk.sh
6453
scripts/psvita_sdk.sh
6554
echo "VITASDK=/usr/local/vitasdk" >> $GITHUB_ENV
6655
echo "$VITASDK/bin" >> $GITHUB_PATH
67-
- name: Create build environment
68-
run: cmake -E make_directory ${{github.workspace}}/build
6956
- name: Configure CMake
70-
working-directory: build
71-
run: cmake .. --preset "psvita-release"
72-
- name: Build
73-
working-directory: build
74-
run: cmake --build . --parallel $(nproc)
57+
run: cmake --preset "psvita-release"
7558
- name: Generate configuration files
7659
working-directory: build
77-
run: |
78-
chmod +x ${{ github.workspace }}/scripts/psvita_generate_configs.sh
79-
${{ github.workspace }}/scripts/psvita_generate_configs.sh
80-
- name: Package
81-
run: cpack --config CPackConfig.cmake
60+
run: ${{ github.workspace }}/scripts/psvita_generate_configs.sh
61+
- name: Build and Package
8262
working-directory: build
63+
run: |
64+
cmake --build . --parallel $(nproc)
65+
cpack --config CPackConfig.cmake
8366
- name: Upload artifacts
8467
uses: actions/upload-artifact@v4
8568
with:
@@ -94,25 +77,20 @@ jobs:
9477
fail-fast: false
9578
steps:
9679
- name: Checkout sources
97-
uses: actions/checkout@v4
80+
uses: actions/checkout@v5
9881
with:
9982
fetch-depth: 0
10083
submodules: recursive
10184
- name: Setup Visual Studio
10285
uses: ilammy/msvc-dev-cmd@v1
10386
with:
10487
arch: ${{ matrix.arch }}
105-
- name: Configure project
88+
- name: Configure
10689
run: cmake --preset "win32-ci-${{ matrix.arch }}"
107-
- name: Run appversion.sh
108-
run: regamedll/version/appversion.sh "${{ github.workspace }}/3rdparty/ReGameDLL_CS"
109-
shell: bash
110-
working-directory: 3rdparty/ReGameDLL_CS
111-
- name: Build
112-
run: cmake --build .
113-
working-directory: build
114-
- name: Package
115-
run: cpack --config CPackConfig.cmake
90+
- name: Build and Package
91+
run: |
92+
cmake --build .
93+
cpack --config CPackConfig.cmake
11694
working-directory: build
11795
- name: Upload artifacts
11896
uses: actions/upload-artifact@v4
@@ -137,15 +115,14 @@ jobs:
137115
sudo dpkg --add-architecture i386
138116
sudo apt-get update
139117
sudo apt-get install libatomic1:i386 libgcc-s1:i386 \
140-
libstdc++6:i386 gcc-multilib g++-multilib cmake \
118+
libstdc++6:i386 gcc-multilib g++-multilib \
141119
ninja-build libfontconfig-dev:i386 libfontconfig-dev
142-
- name: Configure project
120+
- name: Configure
143121
run: cmake --preset "linux-ci-${{ matrix.arch }}"
144-
- name: Build
145-
run: cmake --build .
146-
working-directory: build
147-
- name: Package
148-
run: cpack --config CPackConfig.cmake
122+
- name: Build and Package
123+
run: |
124+
cmake --build .
125+
cpack --config CPackConfig.cmake
149126
working-directory: build
150127
- name: Upload artifacts
151128
uses: actions/upload-artifact@v4
@@ -155,38 +132,23 @@ jobs:
155132
release:
156133
name: Release
157134
runs-on: ubuntu-latest
135+
if: github.ref == 'refs/heads/main'
158136
needs: [android, windows, linux, psvita]
159137
steps:
160138
- name: Fetch artifacts
161139
uses: actions/download-artifact@v4
162140
- name: Remove old release
163-
uses: ClementTsang/delete-tag-and-release@v0.3.1
141+
run: |
142+
TAG_NAME=${{ github.ref_name == 'main' && 'continuous' || format('continuous-{0}', github.ref_name) }}
143+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
144+
if gh release list | grep -q -e "$TAG_NAME"; then
145+
gh release delete "$TAG_NAME" --yes --cleanup-tag --repo ${{ github.repository }}
146+
fi
164147
env:
165148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166-
with:
167-
tag_name: continuous
168-
delete_release: true
169-
repo: ${{ env.GITHUB_REPOSITORY }}
170-
- name: Prepare release
171-
run: |
172-
mv Android/app-ci-unsigned-signed.apk CS16Client-Android.apk
173-
174-
mv */*.zip .
175-
mv */*.tar.gz .
176-
177-
sleep 60s
178-
# - name: Purge artifacts
179-
# uses: geekyeggo/delete-artifact@v2
180-
# with:
181-
# name: "*"
182149
- name: Upload new release
183-
uses: svenstaro/upload-release-action@v2
184-
with:
185-
repo_name: ${{ env.GITHUB_REPOSITORY }}
186-
repo_token: ${{ secrets.GITHUB_TOKEN }}
187-
file_glob: true
188-
file: CS16Client-*
189-
tag: continuous
190-
overwrite: true
191-
prerelease: true
192-
release_name: CS16Client development build
150+
run: |
151+
gh release create ${{ env.TAG_NAME }} --title "CS16Client development build" --prerelease */CS16Client-* \
152+
--repo ${{ github.repository }}
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
*.ilk
4444
*.autosave
4545

46-
android/pak/
47-
android/assets/extras.pak
46+
android/app/src/main/assets
4847
*-build
4948
*admob-id.xml
5049

CMakeLists.txt

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.10)
22
project(cs16-client)
33

44
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
5-
set(EXTRAS_DIR "${CMAKE_CURRENT_BINARY_DIR}/extras")
65

76
include(LibraryNaming)
87
# include(ExternalProject)
98

9+
# for extras packaging
10+
find_package(Python COMPONENTS Interpreter REQUIRED)
11+
12+
if (Python_FOUND)
13+
message(STATUS "Python interpreter found: ${Python_EXECUTABLE}")
14+
else()
15+
message(FATAL_ERROR "Python not found. Please install Python.")
16+
endif()
17+
1018
option(BUILD_CLIENT "Build client library." ON)
1119
option(BUILD_MAINUI "Build menu library." ON)
1220
option(BUILD_SERVER "Build server library." ON)
@@ -60,7 +68,65 @@ if(BUILD_MAINUI)
6068
add_subdirectory(3rdparty/mainui_cpp)
6169
endif()
6270

63-
include(GenerateExtras)
71+
set(GRAPHS_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/graphs")
72+
73+
execute_process(
74+
COMMAND ${Python_EXECUTABLE}
75+
${CMAKE_CURRENT_SOURCE_DIR}/scripts/yapb_graph_dl.py
76+
${GRAPHS_OUTPUT}/addons/yapb/data/graph
77+
)
78+
79+
set(EXTRAS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cs16client-extras")
80+
set(YAPB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/yapb/cfg")
81+
82+
if(ANDROID)
83+
set(EXTRAS_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/android/app/src/main/assets")
84+
85+
file(GLOB EXTRAS_FILES "${EXTRAS_DIR}/*")
86+
file(GLOB YAPB_FILES "${YAPB_DIR}/*" "${GRAPHS_OUTPUT}/*")
87+
88+
file(REMOVE_RECURSE ${EXTRAS_OUTPUT})
89+
file(
90+
COPY ${EXTRAS_FILES} ${YAPB_FILES}
91+
DESTINATION ${EXTRAS_OUTPUT}
92+
)
93+
else()
94+
set(EXTRAS_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/extras.pk3")
95+
96+
execute_process(
97+
COMMAND ${Python_EXECUTABLE}
98+
${CMAKE_CURRENT_SOURCE_DIR}/scripts/pack_extras.py
99+
${EXTRAS_OUTPUT}
100+
${EXTRAS_DIR}
101+
${YAPB_DIR}
102+
${GRAPHS_OUTPUT}
103+
)
104+
105+
add_custom_target(generate_extras ALL
106+
DEPENDS ${GRAPHS_OUTPUT} ${EXTRAS_OUTPUT}
107+
)
108+
109+
install(
110+
FILES "${EXTRAS_OUTPUT}"
111+
DESTINATION ${GAME_DIR}
112+
)
113+
endif()
114+
115+
if(VITA)
116+
install(
117+
FILES
118+
"${CMAKE_CURRENT_BINARY_DIR}/config.cfg"
119+
"${CMAKE_CURRENT_BINARY_DIR}/video.cfg"
120+
"${CMAKE_CURRENT_BINARY_DIR}/opengl.cfg"
121+
DESTINATION "${GAME_DIR}/"
122+
)
123+
124+
install(
125+
FILES
126+
"${CMAKE_CURRENT_BINARY_DIR}/kb_def.lst"
127+
DESTINATION "${GAME_DIR}/gfx/shell"
128+
)
129+
endif()
64130

65131
if(WIN32)
66132
set(CPACK_GENERATOR "ZIP")

0 commit comments

Comments
 (0)