Skip to content

Build Release Artifacts #18

Build Release Artifacts

Build Release Artifacts #18

Workflow file for this run

name: Build Release Artifacts
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
CONFIG: Release
jobs:
linux-omp:
name: Build Linux .so - open.mp (32-bit)
runs-on: ubuntu-latest
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare build folder
run: |
mkdir -p docker/build-omp
sudo chown 1000:1000 docker/build-omp
- name: Build Docker image
run: |
docker build -t randomix/build:ubuntu-22.04 docker/build_ubuntu-22.04/
- name: Build open.mp component
run: |
docker run --rm -t \
-w /code \
-v "${{ github.workspace }}:/code" \
-v "${{ github.workspace }}/docker/build-omp:/code/build" \
-e CONFIG=${{ env.CONFIG }} \
-e BUILD_SAMP_PLUGIN=0 \
randomix/build:ubuntu-22.04
- name: Upload open.mp artifact
uses: actions/upload-artifact@v4
with:
name: randomix-omp-linux
path: docker/build-omp/Randomix.so
linux-samp:
name: Build Linux .so - SA-MP (32-bit)
runs-on: ubuntu-latest
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare build folder
run: |
mkdir -p docker/build-samp
sudo chown 1000:1000 docker/build-samp
- name: Build Docker image
run: |
docker build -t randomix/build:ubuntu-22.04 docker/build_ubuntu-22.04/
- name: Build SA-MP plugin
run: |
docker run --rm -t \
-w /code \
-v "${{ github.workspace }}:/code" \
-v "${{ github.workspace }}/docker/build-samp:/code/build" \
-e CONFIG=${{ env.CONFIG }} \
-e BUILD_SAMP_PLUGIN=1 \
randomix/build:ubuntu-22.04
- name: Upload SA-MP artifact
uses: actions/upload-artifact@v4
with:
name: randomix-samp-linux
path: docker/build-samp/Randomix.so
windows-omp:
name: Build Windows .dll - open.mp (32-bit)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure CMake for open.mp
run: |
cmake -S . -B build-omp -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release
shell: powershell
- name: Build open.mp
run: |
cmake --build build-omp --config Release --parallel
shell: powershell
- name: Check file size and compare with SA-MP
run: |
Write-Host "=== open.mp build ==="
Get-ChildItem -Path "build-omp\Release\Randomix.dll" | Select-Object Name, @{N="SizeKB";E={[math]::Round($_.Length/1KB,2)}}
Write-Host "`nAll files in open.mp Release folder:"
Get-ChildItem -Path "build-omp\Release" | Select-Object Name, @{N="SizeKB";E={[math]::Round($_.Length/1KB,2)}}
shell: powershell
- name: Upload open.mp artifact
uses: actions/upload-artifact@v4
with:
name: randomix-omp-windows
path: build-omp/Release/Randomix.dll
windows-samp:
name: Build Windows .dll - SA-MP (32-bit)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure CMake for SA-MP
run: |
cmake -S . -B build-samp -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMP_PLUGIN=ON -T host=x86
shell: powershell
- name: Build SA-MP
run: |
cmake --build build-samp --config Release --parallel -- /p:CharacterSet=MultiByte /p:WholeProgramOptimization=true
shell: powershell
- name: Check file size and check for PDB
run: |
$dll = Get-ChildItem -Path "build-samp\Release\Randomix.dll"
Write-Host "DLL File: $($dll.Name)"
Write-Host "DLL Size: $($dll.Length) bytes ($([math]::Round($dll.Length/1KB,2)) KB)"
# Check if PDB file exists (debug symbols)
$pdbPath = "build-samp\Release\Randomix.pdb"
if (Test-Path $pdbPath) {
$pdb = Get-ChildItem $pdbPath
Write-Host "PDB File Found: $($pdb.Name) - $($pdb.Length) bytes"
} else {
Write-Host "No PDB file found (good for release)"
}
# List all files in Release folder
Write-Host "`nAll files in Release folder:"
Get-ChildItem -Path "build-samp\Release" | Select-Object Name, @{N="SizeKB";E={[math]::Round($_.Length/1KB,2)}}
shell: powershell
- name: Upload SA-MP artifact
uses: actions/upload-artifact@v4
with:
name: randomix-samp-windows
path: build-samp/Release/Randomix.dll
release:
name: Create Release
needs: [linux-omp, linux-samp, windows-omp, windows-samp]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display artifacts
run: |
echo "=== Artifacts ==="
find artifacts -type f -name "*.so" -o -name "*.dll" | sort
- name: Rename artifacts
run: |
mkdir -p release
cp artifacts/randomix-omp-linux/Randomix.so release/Randomix-omp-linux-x86.so
cp artifacts/randomix-samp-linux/Randomix.so release/Randomix-samp-linux-x86.so
cp artifacts/randomix-omp-windows/Randomix.dll release/Randomix-omp-win-x86.dll
cp artifacts/randomix-samp-windows/Randomix.dll release/Randomix-samp-win-x86.dll
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}