Skip to content

Commit 6b9f36b

Browse files
committed
Add CD for PC platforms
1 parent 690daea commit 6b9f36b

File tree

7 files changed

+126
-6
lines changed

7 files changed

+126
-6
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ indent_size = 4
1818
[{CMakeLists.txt,*.cmake}]
1919
indent_style = space
2020
indent_size = 4
21+
22+
# GitHub Workflows
23+
[*.yml]
24+
indent_style = space
25+
indent_size = 2

.github/workflows/cd-pc.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
pull_request:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build:
16+
name: ${{ matrix.platform.name }} ${{ matrix.backend.name }} ${{ matrix.config.name }}
17+
runs-on: ${{ matrix.platform.os }}
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
platform:
23+
- { name: Windows, os: windows-latest }
24+
- { name: Linux, os: ubuntu-latest }
25+
- { name: macOS AMD64, os: macos-13 }
26+
- { name: macOS AArch64, os: macos-latest }
27+
backend:
28+
- { name: GNS, flags: -DUSE_STEAMWORKS=FALSE }
29+
- { name: Steamworks, flags: -DUSE_STEAMWORKS=TRUE }
30+
config:
31+
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
32+
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: ${{matrix.backend.name == 'GNS'}}
39+
40+
- name: Cache Steamworks SDK
41+
if: matrix.backend.name == 'Steamworks'
42+
id: cache-steamworks-sdk
43+
uses: actions/cache@v4
44+
with:
45+
path: sdk.zip
46+
key: steamworks-sdk-162
47+
48+
- name: Download Steamworks SDK
49+
if: matrix.backend.name == 'Steamworks' && steps.cache-steamworks-sdk.outputs.cache-hit != 'true'
50+
uses: suisei-cn/actions-download-file@v1.6.0
51+
with:
52+
filename: sdk.zip
53+
target: .
54+
url: https://partner.steamgames.com/downloads/steamworks_sdk_162.zip
55+
56+
- name: Unzip Steamworks SDK
57+
if: matrix.backend.name == 'Steamworks'
58+
shell: bash
59+
run: unzip sdk.zip
60+
61+
- name: Install CMake
62+
uses: lukka/get-cmake@latest
63+
64+
- name: Install Windows GNS Dependencies
65+
if: matrix.backend.name == 'GNS' && runner.os == 'Windows'
66+
uses: lukka/run-vcpkg@v11
67+
with:
68+
vcpkgDirectory: 'C:/vcpkg'
69+
vcpkgGitCommitId: '300239058e33420acd153135b3f6e6b187828992'
70+
vcpkgJsonGlob: 'vcpkg.json'
71+
runVcpkgInstall: true
72+
73+
- name: Install Linux GNS Dependencies
74+
if: matrix.backend.name == 'GNS' && runner.os == 'Linux'
75+
run: sudo apt update -y && sudo apt install -y libprotobuf-dev protobuf-compiler
76+
77+
- name: Install macOS GNS Dependencies
78+
if: matrix.backend.name == 'GNS' && runner.os == 'macOS'
79+
shell: bash
80+
run: brew install protobuf
81+
82+
- name: Run CMake
83+
uses: lukka/run-cmake@v10
84+
with:
85+
configurePreset: "nalchi-cd-config"
86+
configurePresetAdditionalArgs: "['${{matrix.backend.flags}}', '${{matrix.config.flags}}', '${{runner.os == 'Windows' && matrix.backend.name == 'GNS' && '-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake' || ''}}']"
87+
buildPreset: "nalchi-cd-build"
88+
packagePreset: "nalchi-cd-pack"
89+
90+
- name: Release
91+
uses: softprops/action-gh-release@v2
92+
if: startsWith(github.ref, 'refs/tags/')
93+
with:
94+
files: build/nalchi-*-*-*-*-*.*

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy docs
1+
name: API Docs
22

33
on:
44
push:

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ else()
279279
endif()
280280

281281
if(BUILD_SHARED_LIBS)
282-
set(NALCHI_PACK_SHARED shared)
282+
set(NALCHI_PACK_SHARED Shared)
283283
else()
284-
set(NALCHI_PACK_SHARED static)
284+
set(NALCHI_PACK_SHARED Static)
285285
endif()
286286

287-
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${NALCHI_PACK_BACKEND}-${nalchi_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-${NALCHI_PACK_SHARED})
287+
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${NALCHI_PACK_BACKEND}-v${nalchi_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-${NALCHI_PACK_SHARED})
288288

289289
include(CPack)

CMakePresets.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"version": 6,
33
"configurePresets": [
4+
{
5+
"name": "nalchi-cd-config",
6+
"binaryDir": "build"
7+
},
48
{
59
"name": "nalchi-gns",
610
"generator": "Ninja Multi-Config",
@@ -63,5 +67,19 @@
6367
"BUILD_SHARED_LIBS": true
6468
}
6569
}
70+
],
71+
"buildPresets": [
72+
{
73+
"name": "nalchi-cd-build",
74+
"configurePreset": "nalchi-cd-config",
75+
"configuration": "Release"
76+
}
77+
],
78+
"packagePresets": [
79+
{
80+
"name": "nalchi-cd-pack",
81+
"configurePreset": "nalchi-cd-config",
82+
"configurations": ["Release"]
83+
}
6684
]
6785
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
<img align="right" src="https://raw.githubusercontent.com/nalchi-net/nalchi/refs/heads/main/doc/nalchi.png" width="100px">
44

5+
<img align="top" src="https://github.com/nalchi-net/nalchi/actions/workflows/cd-pc.yml/badge.svg">
6+
<img align="top" src="https://github.com/nalchi-net/nalchi/actions/workflows/deploy-docs.yml/badge.svg">
7+
58
[nalchi](https://github.com/nalchi-net/nalchi) aims to provide utilities for efficient message sending over [ValveSoftware/GameNetworkingSockets](https://github.com/ValveSoftware/GameNetworkingSockets).
69

710
## Features

vcpkg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
33
"name": "nalchi",
4-
"version-string": "0.0.1",
5-
"description": "A lightweight wrapper around Valve's GameNetworkingSockets",
4+
"version-string": "0.1.0",
5+
"description": "Utilities for efficient message sending over Valve's GameNetworkingSockets",
66
"homepage": "https://github.com/nalchi-net/nalchi",
77
"dependencies": [
88
"protobuf",

0 commit comments

Comments
 (0)