Turn closesocket into a function #555
Workflow file for this run
This file contains 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
name: Workflow | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'ci-*' | |
tags: | |
- 'v*' | |
pull_request: | |
jobs: | |
ci: | |
strategy: | |
matrix: | |
platform: | |
- { name: 'Linux', arch: 'x64', os: ubuntu-latest, werror: true } | |
- { name: 'Linux', arch: 'arm64', os: ubuntu-latest, werror: true, cmake-toolchain-file: 'cmake/toolchains/linux-aarch64.cmake', apt-packages: 'gcc-aarch64-linux-gnu g++-aarch64-linux-gnu', cross: true } | |
- { name: 'MacOS', arch: 'arm64-x64', os: macos-latest, werror: true, cmake-args: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' } | |
- { name: 'Windows', arch: 'x86', os: windows-latest, msvc-arch: 'Win32' } | |
- { name: 'Windows', arch: 'x64', os: windows-latest, msvc-arch: 'x64' } | |
# - { name: 'Windows', arch: 'arm64', os: windows-latest, msvc-arch: 'amd64_arm64', cross: true } | |
defaults: | |
run: | |
shell: sh | |
runs-on: '${{ matrix.platform.os }}' | |
name: 'CI ${{ matrix.platform.name }} ${{ matrix.platform.arch }}' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Ninja | |
uses: aseprite/get-ninja@main | |
- uses: ilammy/msvc-dev-cmd@v1.13.0 | |
if: ${{ !!matrix.platform.msvc-arch }} | |
with: | |
arch: ${{ matrix.platform.msvc-arch }} | |
- name: Install Linux dependencies | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgl-dev ${{ matrix.platform.apt-packages }} | |
- name: Set up SDL | |
uses: libsdl-org/setup-sdl@main | |
with: | |
cmake-arguments: ${{ matrix.platform.cmake-args }} | |
cmake-generator: Ninja | |
cmake-toolchain-file: ${{ matrix.platform.cmake-toolchain-file }} | |
version: 2-latest | |
add-to-environment: true | |
- name: 'Prepare sources for release' | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
echo "${{ github.ref_name }}" >VERSION | |
- name: 'Configure (CMake)' | |
id: configure | |
run: | | |
cmake -B build -GNinja \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DBUILD_TESTS=ON \ | |
-DDETHRACE_WERROR=${{ !!matrix.platform.werror }} \ | |
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \ | |
-DDETHRACE_INSTALL=ON \ | |
-DDETHRACE_PACKAGE_PLATFORM=${{ matrix.platform.name }} \ | |
-DDETHRACE_PACKAGE_ARCH=${{ matrix.platform.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.platform.cmake-toolchain-file }} \ | |
${{ matrix.platform.cmake-args }} | |
- name: 'Build (CMake)' | |
run: | | |
cmake --build build | |
- name: 'Test (CTest)' | |
if: ${{ !matrix.platform.cross }} | |
run: | | |
ctest --test-dir build --verbose | |
- name: 'Package (CPack)' | |
run: | | |
cd build | |
cpack . | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ steps.configure.outputs.filename }}' | |
path: 'build/dist/${{ steps.configure.outputs.filename }}' | |
if-no-files-found: error | |
create-release: | |
name: Create Release | |
needs: [ci] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Calculate Variables | |
id: vars | |
run: | | |
echo "ref_name_without_v=$(echo ${GITHUB_REF_NAME} | cut -c2-)" >>$GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: false | |
prerelease: false | |
name: Dethrace ${{ steps.vars.outputs.ref_name_without_v }} | |
generate_release_notes: true | |
files: | | |
artifacts/** |