116 lines
3.3 KiB
YAML
116 lines
3.3 KiB
YAML
name: Build libsm64
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
|
|
jobs:
|
|
Build:
|
|
name: Build libsm64 for ${{ matrix.identifier }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- identifier: linux
|
|
os: ubuntu-latest
|
|
- identifier: windows
|
|
os: ubuntu-latest
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout project
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: (Windows) Install MinGW
|
|
if: matrix.identifier == 'windows'
|
|
run: |
|
|
sudo apt-get update -y -qq
|
|
sudo apt-get install -y mingw-w64
|
|
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
|
|
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
|
|
|
- name: (Linux) Install dependencies
|
|
if: matrix.identifier == 'linux'
|
|
run: |
|
|
sudo apt-get update -y -qq
|
|
sudo apt-get install -y libsdl2-dev libglew-dev
|
|
|
|
- name: Build shared library
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
|
CC=x86_64-w64-mingw32-gcc \
|
|
CXX=x86_64-w64-mingw32-g++
|
|
else
|
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
|
fi
|
|
|
|
- name: Build test executable (Linux only)
|
|
if: matrix.identifier == 'linux'
|
|
run: make test -j$(nproc)
|
|
|
|
- name: Prepare artifacts
|
|
run: |
|
|
mkdir -p artifacts/${{ matrix.identifier }}
|
|
cp -r dist artifacts/${{ matrix.identifier }}/
|
|
cp README.md artifacts/${{ matrix.identifier }}/
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libsm64_${{ matrix.identifier }}
|
|
path: artifacts/${{ matrix.identifier }}
|
|
|
|
Release:
|
|
name: Snapshot Release
|
|
runs-on: ubuntu-latest
|
|
needs: Build
|
|
|
|
# IMPORTANT: prevents running on tag pushes
|
|
if: github.ref_type == 'branch'
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create Release
|
|
id: release
|
|
uses: gitea/actions/gitea-release-action@v1
|
|
with:
|
|
api_key: ${{ secrets.GITEA_TOKEN }}
|
|
owner: NepuShiro
|
|
repo: libsm64
|
|
tag_name: build-${{ github.sha }}
|
|
release_name: Snapshot Build ${{ github.sha }}
|
|
prerelease: true
|
|
|
|
- name: Upload Linux artifact
|
|
uses: actions/upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
|
asset_path: artifacts/libsm64_linux.zip
|
|
asset_name: libsm64_linux.zip
|
|
asset_content_type: application/zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Upload Windows artifact
|
|
uses: actions/upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
|
asset_path: artifacts/libsm64_windows.zip
|
|
asset_name: libsm64_windows.zip
|
|
asset_content_type: application/zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }} |