forked from SLikeSoft/SLikeNet
-
Notifications
You must be signed in to change notification settings - Fork 1
ci: ship prebuilt libraries on release #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Segfaultd
wants to merge
2
commits into
master
Choose a base branch
from
ci/release-artifacts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| name: Release Artifacts | ||
|
|
||
| # Builds prebuilt MafiaNet libraries for all supported runtimes whenever a | ||
| # release is published, then attaches a single combined archive (headers + | ||
| # libraries) to that release. | ||
| # | ||
| # Correctness is gated separately by build.yml on push/PR; this workflow is | ||
| # packaging-only and runs no tests. | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| # Build and stage an install tree (include + lib [+ bin]) per runtime. | ||
| build: | ||
| name: Build ${{ matrix.key }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - key: linux-x64 | ||
| os: ubuntu-latest | ||
| - key: macos-x64 | ||
| os: macos-15-intel | ||
| - key: macos-arm64 | ||
|
Segfaultd marked this conversation as resolved.
|
||
| os: macos-14 | ||
| - key: windows-x64 | ||
| os: windows-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
Segfaultd marked this conversation as resolved.
|
||
|
|
||
| - name: Install OpenSSL (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libssl-dev | ||
|
|
||
| - name: Install OpenSSL (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: brew install openssl@3 | ||
|
|
||
| # Both static and shared libraries are ON by default in CMakeLists.txt, | ||
| # so no extra MAFIANET_BUILD_* flags are required. | ||
| - name: Configure (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| cmake -B build \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/stage" | ||
|
|
||
| - name: Configure (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| cmake -B build \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)" \ | ||
| -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/stage" | ||
|
|
||
| - name: Configure (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: > | ||
| cmake -B build | ||
| -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/stage" | ||
|
|
||
| - name: Build | ||
| run: cmake --build build --config Release --parallel | ||
|
|
||
| - name: Install | ||
| run: cmake --install build --config Release | ||
|
|
||
| - name: Upload staged install tree | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ matrix.key }} | ||
| path: stage | ||
| if-no-files-found: error | ||
|
|
||
| # Combine all runtime trees into a single archive and attach it to the release. | ||
| package: | ||
| name: Package & attach to release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Download all staged trees | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: dist | ||
|
|
||
| - name: Assemble combined archive | ||
| env: | ||
| TAG: ${{ github.event.release.tag_name }} | ||
| run: | | ||
| set -euo pipefail | ||
| VER="${TAG#v}" | ||
| ROOT="mafianet-${VER}" | ||
| mkdir -p "${ROOT}/include" "${ROOT}/lib" | ||
|
|
||
| # Headers are identical across platforms — keep a single shared copy. | ||
| cp -R dist/linux-x64/include/. "${ROOT}/include/" | ||
|
|
||
| for rt in linux-x64 macos-x64 macos-arm64 windows-x64; do | ||
| mkdir -p "${ROOT}/lib/${rt}" | ||
| # Static/import libs and CMake package config (lib or lib64). | ||
| for d in dist/"${rt}"/lib dist/"${rt}"/lib64; do | ||
| [ -d "$d" ] && cp -R "$d/." "${ROOT}/lib/${rt}/" | ||
| done | ||
| # Shared runtime binaries (.dll) install to bin/ — fold them in so | ||
| # the shared library is usable, keeping the layout to include + lib. | ||
| [ -d "dist/${rt}/bin" ] && cp -R "dist/${rt}/bin/." "${ROOT}/lib/${rt}/" | ||
| done | ||
|
|
||
| cat > "${ROOT}/README.txt" <<EOF | ||
| MafiaNet ${VER} — prebuilt libraries | ||
|
|
||
| Layout: | ||
| include/ Public headers (mafianet/...), shared across all runtimes. | ||
| lib/<runtime>/ Static + shared libraries and the CMake package config | ||
| for each runtime (linux-x64, macos-x64, macos-arm64, | ||
| windows-x64). | ||
|
|
||
| Note: the shared libraries dynamically link OpenSSL 3 from the machine | ||
| they were built on. Consumers need a compatible OpenSSL 3 installed at | ||
| runtime. The static libraries avoid this dependency. | ||
| EOF | ||
|
|
||
| zip -r "${ROOT}-all.zip" "${ROOT}" | ||
|
|
||
| - name: Attach archive to release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| TAG: ${{ github.event.release.tag_name }} | ||
| run: | | ||
| set -euo pipefail | ||
| VER="${TAG#v}" | ||
| gh release upload "${TAG}" "mafianet-${VER}-all.zip" --clobber | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.