Reorganizing server-side source code: entities, monsters and weapons #945
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nightly-builds | |
on: | |
push: | |
paths-ignore: | |
- 'documentation/**' | |
pull_request: | |
paths-ignore: | |
- 'documentation/**' | |
permissions: | |
contents: write | |
jobs: | |
build-generic: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
cmake_preset: windows-x86-debug | |
build_conf: Debug | |
devenv_arch: amd64_x86 | |
- os: windows-latest | |
cmake_preset: windows-x64-debug | |
build_conf: Debug | |
devenv_arch: amd64 | |
- os: windows-latest | |
cmake_preset: windows-x64-release | |
build_conf: RelWithDebInfo | |
devenv_arch: amd64 | |
- os: ubuntu-22.04 | |
cmake_preset: linux-x64-debug | |
build_conf: Debug | |
devenv_arch: none | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Enables the vcpkg dependency graph integration. | |
VCPKG_FEATURE_FLAGS: dependencygraph | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: ${{ github.workspace }}/external/vcpkg | |
# Tells vcpkg where binary packages are stored. | |
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/vcpkg/bincache | |
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | |
steps: | |
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage | |
# for Binary Caching. | |
- name: Set env vars needed for vcpkg to leverage the GitHub Action cache | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Create build environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory ${{ github.workspace }}/build | |
- uses: ilammy/[email protected] | |
if: runner.os == 'Windows' | |
with: | |
arch: ${{ matrix.devenv_arch }} | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc-multilib g++-multilib cmake | |
sudo apt-get install qtbase5-dev | |
- name: Install ninja-build tool | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | |
shell: bash | |
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | |
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching | |
# when it is being run afterwards by CMake. | |
- name: Restore vcpkg | |
uses: actions/cache@v3 | |
with: | |
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the | |
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. | |
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. | |
path: | | |
${{ env.VCPKG_ROOT }} | |
!${{ env.VCPKG_ROOT }}/buildtrees | |
!${{ env.VCPKG_ROOT }}/packages | |
!${{ env.VCPKG_ROOT }}/downloads | |
!${{ env.VCPKG_ROOT }}/installed | |
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. | |
key: | | |
${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}} | |
- name: Configure CMake | |
working-directory: ${{ github.workspace }}/build | |
# Note the current convention is to use the -S and -B options here to specify source | |
# and build directories, but this is only available with CMake 3.13 and higher. | |
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | |
run: cmake "${{ github.workspace }}" --preset ${{ matrix.cmake_preset }} | |
- name: Build | |
working-directory: ${{ github.workspace }}/build | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: cmake --build . --parallel 4 | |
- name: Prepare artifacts | |
shell: bash | |
run: | | |
ls -l build/ | |
mkdir artifacts/ | |
mkdir -p publish/primext/bin | |
mkdir -p publish/primext/devkit | |
cp -r build/${{ matrix.build_conf }}/primext/* publish/primext/ | |
cp build/${{ matrix.build_conf }}/primext_run publish/ || true | |
cp build/${{ matrix.build_conf }}/primext.exe publish/ || true | |
cp -r game_dir/* publish/primext | |
- name: Pack artifact files to archive (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
pushd publish | |
zip -r ../artifacts/primext-${{ matrix.cmake_preset }}.zip ./* | |
popd | |
# we forced to do this split because Git on Windows can't use zip, bruh | |
- name: Pack artifact files to archive (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
Compress-Archive -Path publish\* -Destination artifacts\primext-${{ matrix.cmake_preset }}.zip | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-${{ matrix.cmake_preset }} | |
path: artifacts/* | |
build-android: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
conf: [Debug] | |
env: | |
BUILD_TYPE: ${{ matrix.conf }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc-multilib g++-multilib cmake ninja-build | |
- name: Setup Java | |
uses: actions/[email protected] | |
with: | |
distribution: 'microsoft' | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Build | |
run: chmod +x ./gradlew && ./gradlew assembleDebug | |
working-directory: android | |
env: | |
ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/26.1.10909125 | |
- name: Prepare artifacts | |
run: | | |
mkdir artifacts/ | |
cp android/app/build/outputs/apk/debug/app-debug.apk artifacts/primext-debug.apk | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-android-debug | |
path: artifacts/* | |
release: | |
name: release-builds | |
runs-on: ubuntu-latest | |
needs: [build-generic] | |
steps: | |
- name: Check for pull request | |
uses: 8BitJonny/[email protected] | |
id: pr-check | |
with: | |
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.) | |
sha: ${{ github.event.pull_request.head.sha }} | |
- name: Fetch artifacts | |
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }} | |
uses: actions/[email protected] | |
with: | |
path: artifacts/ | |
- name: Remove old release | |
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }} | |
uses: dev-drprasad/[email protected] | |
with: | |
delete_release: true | |
tag_name: continious | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Repackage binaries and allow GitHub to process removed release for few seconds | |
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }} | |
continue-on-error: true | |
run: | | |
cd artifacts/ | |
for i in artifact-*; do | |
mv "$i"/* . | |
rm -rf "$i" | |
done | |
ls -R . | |
cd ../ | |
sleep 20s | |
- name: Upload new release | |
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }} | |
uses: softprops/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: artifacts/* | |
tag_name: continious | |
draft: false | |
prerelease: true | |
name: PrimeXT Continuous Build |