diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build.yml | 87 | ||||
-rw-r--r-- | .github/workflows/release.yml | 187 |
2 files changed, 274 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1adb852 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,87 @@ +name: CMake + +on: [push, pull_request] + +env: + BUILD_TYPE: Release + +jobs: + debian-bookworm: + runs-on: ubuntu-latest + container: + image: debian:bookworm + + strategy: + matrix: + storm_use_bundled_libraries: [ ON, OFF ] + with_libtomcrypt: [ ON, OFF ] + build_shared_libs: [ ON, OFF ] + unicode: [ ON, OFF ] + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: apt-get -y update && apt-get install -y build-essential cmake + + - name: Conditionally install libtomcrypt-dev + if: matrix.with_libtomcrypt == 'ON' + run: apt-get install -y libtomcrypt-dev pkg-config + + - name: CMake Configuration + run: | + cmake -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D STORM_USE_BUNDLED_LIBRARIES=${{ matrix.storm_use_bundled_libraries }} \ + -D WITH_LIBTOMCRYPT=${{ matrix.with_libtomcrypt }} \ + -D BUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} \ + -D STORM_UNICODE=${{ matrix.unicode }} + + - name: Build + run: cmake --build build --config Release + + fedora-latest: + if: true + runs-on: ubuntu-latest + container: + image: fedora:latest + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: dnf -y install cmake gcc gcc-c++ + + - name: Cmake + run: cmake -B build -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D BUILD_SHARED_LIBS=ON + + - name: Build + run: cmake --build build --config Release + + windows-latest-x64: + if: true + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: Cmake + run: cmake -B build -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D BUILD_SHARED_LIBS=ON + + - name: Build + run: cmake --build build --config Release + + - name: Debug + shell: bash + run: ls -la build + + - name: Check PE + shell: bash + working-directory: ./build/Release + run: | + file "stormlib.dll" + file "stormlib.dll" |grep "x86-64"
\ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..18702ed --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,187 @@ +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 }}
\ No newline at end of file |