Server: Fix crash when spawning ship in space #324
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: Build & Push binaries | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
push: | |
paths-ignore: | |
- '.gitignore' | |
- 'LICENSE' | |
- 'README.md' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { runner: windows-latest, os: windows, arch: x64, archive_ext: .zip } | |
- { runner: ubuntu-latest, os: linux, arch: x86_64, archive_ext: .tar.gz } | |
- { runner: macos-12, os: macos, arch: x86_64, archive_ext: .tar.gz } | |
- { runner: macos-14, os: macos, arch: arm64, archive_ext: .tar.gz } | |
mode: [debug, releasedbg] | |
runs-on: ${{ matrix.platform.runner }} | |
steps: | |
- name: Get current date as package key | |
id: cache_key | |
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: "Set OUTPUT_FILE variable" | |
run: echo "OUTPUT_FILE=${{ matrix.platform.os }}_${{ matrix.platform.arch }}_${{ matrix.mode }}${{ matrix.platform.archive_ext }}" >> $GITHUB_ENV | |
shell: bash | |
# Force xmake to a specific folder (for cache) | |
- name: Set xmake env | |
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Clone the whole repository to get correct tags and branches | |
# Install xmake | |
- name: Setup xmake | |
uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: branch@dev | |
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }} | |
# Update xmake repository (in order to have the file that will be cached) | |
- name: Update xmake repository | |
run: xmake repo --update | |
# Fetch xmake dephash | |
- name: Retrieve dependencies hash | |
id: dep_hash | |
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT | |
shell: bash | |
# Retrieve xmake dependencies | |
- name: Restore cached xmake dependencies | |
id: restore-depcache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }} | |
- name: Configure xmake and install dependencies | |
run: xmake config --arch=${{ matrix.platform.arch }} --mode=${{ matrix.mode }} --yes --policies=package.precompiled:n | |
# Save dependencies | |
- name: Save cached xmake dependencies | |
if: ${{ !steps.restore-depcache.outputs.cache-hit }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
key: ${{ steps.restore-depcache.outputs.cache-primary-key }} | |
- name: Build | |
run: xmake | |
- name: Install | |
run: | | |
xmake install -vo dest/ | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
mv ./dest/lib/*.so* ./dest/bin/ | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
mv ./dest/lib/*.dylib* ./dest/bin/ | |
fi | |
rm -rf dest/include/ | |
rm -rf dest/lib/ | |
shell: bash | |
# For some reason macOS-14 doesn't seem to have Python | |
- uses: actions/setup-python@v5 | |
if: ${{ matrix.platform.runner == 'macos-14' }} | |
with: | |
python-version: "3.11" | |
- name: Archive result | |
uses: ihiroky/archive-action@v1 | |
with: | |
root_dir: dest/bin | |
file_path: ${{ env.OUTPUT_FILE }} | |
verbose: true | |
- name: Compute checksum of archive | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
sha256sum -b "$OUTPUT_FILE" > "$OUTPUT_FILE.sha256" | |
else | |
shasum -a 256 -b "$OUTPUT_FILE" > "$OUTPUT_FILE.sha256" | |
fi | |
shell: bash | |
# Nightly tags (for commits to dev branch) | |
- name: Upload binaries to release (Dev) | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.OUTPUT_FILE }} | |
asset_name: ${{ env.OUTPUT_FILE }} | |
tag: "0.0.0-nightly" | |
overwrite: true | |
- name: Upload checksum to release (Dev) | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.OUTPUT_FILE }}.sha256 | |
asset_name: ${{ env.OUTPUT_FILE }}.sha256 | |
tag: "0.0.0-nightly" | |
overwrite: true | |
body: "Dev branch" | |
# Release tags (for tags) | |
- name: Upload binaries to release (Tag) | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ startsWith(github.event.ref, 'refs/tags/') && matrix.mode == 'releasedbg' }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.OUTPUT_FILE }} | |
asset_name: ${{ env.OUTPUT_FILE }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: Upload checksum to release (Tag) | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ startsWith(github.event.ref, 'refs/tags/') && matrix.mode == 'releasedbg' }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.OUTPUT_FILE }}.sha256 | |
asset_name: ${{ env.OUTPUT_FILE }}.sha256 | |
tag: ${{ github.ref }} | |
overwrite: true |