mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-16 05:10:32 +01:00
- make tests it's own CMake project - add CMake option to override hardcoded test data paths - improve CMake documentation, document all options - add basic CI build for Debian, Fedora and Windows - add release pipeline to create .deb, .rpm and Windows li/dll archives
187 lines
5.5 KiB
YAML
187 lines
5.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
deb:
|
|
if: true
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: debian:bookworm
|
|
env:
|
|
BUILD_TYPE: Release
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: apt-get -y update && apt-get install -y build-essential cmake
|
|
|
|
- name: Cmake
|
|
run: cmake -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
|
|
- name: Build
|
|
run: cmake --build build --config $BUILD_TYPE
|
|
|
|
- name: Package
|
|
id: package
|
|
working-directory: build
|
|
run: |
|
|
cpack -G "DEB" -D CPACK_PACKAGE_FILE_NAME=libstorm-dev_${{ github.ref_name }}_amd64
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
retention-days: 1
|
|
overwrite: true
|
|
name: libstorm-dev_${{ github.ref_name }}_amd64.deb
|
|
path: build/libstorm-dev_${{ github.ref_name }}_amd64.deb
|
|
|
|
rpm:
|
|
if: true
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: fedora:latest
|
|
env:
|
|
BUILD_TYPE: Release
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: dnf -y install cmake gcc gcc-c++ rpm-build
|
|
|
|
- name: Cmake
|
|
run: cmake -B build -D BUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
|
|
- name: Build
|
|
run: cmake --build build --config $BUILD_TYPE
|
|
|
|
- name: Package
|
|
working-directory: build
|
|
run: cpack -G "RPM" -D CPACK_PACKAGE_FILE_NAME=libstorm-devel-${{ github.ref_name }}.x86_64
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
retention-days: 1
|
|
overwrite: true
|
|
name: libstorm-devel-${{ github.ref_name }}.x86_64.rpm
|
|
path: build/libstorm-devel-${{ github.ref_name }}.x86_64.rpm
|
|
|
|
build_win:
|
|
if: true
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [ amd64, x86 ]
|
|
build_type: [ Release, Debug ]
|
|
unicode: [ ON, OFF ]
|
|
shared: [ ON, OFF ]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: TheMrMilchmann/setup-msvc-dev@v3
|
|
with:
|
|
arch: ${{ matrix.arch }}
|
|
|
|
- name: Configure CMake for amd64
|
|
if: ${{ matrix.arch == 'amd64' }}
|
|
shell: cmd
|
|
run: cmake -B build -DBUILD_SHARED_LIBS=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTORM_UNICODE=${{ matrix.unicode }}
|
|
|
|
- name: Configure CMake for x86
|
|
if: ${{ matrix.arch == 'x86' }}
|
|
shell: cmd
|
|
run: cmake -B build -DBUILD_SHARED_LIBS=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTORM_UNICODE=${{ matrix.unicode }} -A Win32
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: cmake --build build --config ${{ matrix.build_type }}
|
|
|
|
- name: Check PE
|
|
if: ${{ matrix.shared == 'ON' }}
|
|
shell: bash
|
|
working-directory: ./build/${{ matrix.build_type }}
|
|
run: |
|
|
file "stormlib.dll"
|
|
if [[ "${{ matrix.arch }}" == "x86" ]]; then
|
|
file "stormlib.dll" | grep -E "Intel 80386|Intel i386"
|
|
else
|
|
file "stormlib.dll" | grep "x86-64"
|
|
fi
|
|
|
|
- name: Install to staging area
|
|
shell: cmd
|
|
run: cmake --install build --prefix build/staging --config ${{ matrix.build_type }}
|
|
|
|
- name: Create Archive
|
|
shell: pwsh
|
|
id: create_archive
|
|
working-directory: ./build/staging
|
|
run: |
|
|
$r = if ("${{ matrix.build_type }}" -eq "Release") { "R" } else { "D" }
|
|
$a = if ("${{ matrix.unicode }}" -eq "ON") { "U" } else { "A" }
|
|
$s = if ("${{ matrix.shared }}" -eq "ON") { "D" } else { "S" }
|
|
|
|
$zipSuffix = "${r}${a}${s}"
|
|
$zipName = "stormlib_${{ github.ref_name }}_${{ matrix.arch }}_${zipSuffix}.zip"
|
|
"zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
|
|
Compress-Archive -Path include -DestinationPath $zipName
|
|
|
|
$binItems = Get-ChildItem -Path bin\* -ErrorAction SilentlyContinue
|
|
if ($binItems) {
|
|
Compress-Archive -Path bin/* -DestinationPath $zipName -Update
|
|
}
|
|
$libItems = Get-ChildItem -Path lib\* -ErrorAction SilentlyContinue
|
|
if ($libItems) {
|
|
Compress-Archive -Path "lib/*" -DestinationPath $zipName -Update
|
|
}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
retention-days: 1
|
|
overwrite: true
|
|
name: ${{ steps.create_archive.outputs.zip_name }}
|
|
path: build/staging/${{ steps.create_archive.outputs.zip_name }}
|
|
|
|
release:
|
|
needs: [deb, rpm, build_win]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download deb
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: libstorm-dev_${{ github.ref_name }}_amd64.deb
|
|
|
|
- name: Download rpm
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: libstorm-devel-${{ github.ref_name }}.x86_64.rpm
|
|
|
|
- name: Download win
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: "*.zip"
|
|
merge-multiple: true
|
|
|
|
- name: Generate SHA256 checksums
|
|
run: |
|
|
for file in *.zip *.deb *.rpm; do
|
|
sha256sum "$file" >> "release.sha256"
|
|
done
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
*.deb
|
|
*.sha256
|
|
*.rpm
|
|
*.zip
|
|
tag_name: ${{ github.ref_name }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |