Skip to content

Commit 697ac6e

Browse files
initial commit
1 parent c9dd12f commit 697ac6e

File tree

12 files changed

+424
-2
lines changed

12 files changed

+424
-2
lines changed

.clang-format

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
# This file is centrally managed in https://github.com/<organization>/.github/
3+
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
4+
# the above-mentioned repo.
5+
6+
# Generated from CLion C/C++ Code Style settings
7+
BasedOnStyle: LLVM
8+
AccessModifierOffset: -2
9+
AlignAfterOpenBracket: DontAlign
10+
AlignConsecutiveAssignments: false
11+
AlignOperands: Align
12+
AllowAllArgumentsOnNextLine: false
13+
AllowAllConstructorInitializersOnNextLine: false
14+
AllowAllParametersOfDeclarationOnNextLine: false
15+
AllowShortBlocksOnASingleLine: Always
16+
AllowShortCaseLabelsOnASingleLine: false
17+
AllowShortFunctionsOnASingleLine: All
18+
AllowShortIfStatementsOnASingleLine: WithoutElse
19+
AllowShortLambdasOnASingleLine: All
20+
AllowShortLoopsOnASingleLine: true
21+
AlignTrailingComments: false
22+
AlwaysBreakAfterReturnType: All
23+
AlwaysBreakTemplateDeclarations: MultiLine
24+
BreakBeforeBraces: Custom
25+
BraceWrapping:
26+
AfterCaseLabel: false
27+
AfterClass: false
28+
AfterControlStatement: Never
29+
AfterEnum: false
30+
AfterFunction: false
31+
AfterNamespace: false
32+
AfterObjCDeclaration: false
33+
AfterUnion: false
34+
BeforeCatch: true
35+
BeforeElse: true
36+
IndentBraces: false
37+
SplitEmptyFunction: false
38+
SplitEmptyRecord: true
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeTernaryOperators: false
41+
BreakConstructorInitializers: AfterColon
42+
BreakInheritanceList: AfterColon
43+
ColumnLimit: 0
44+
CompactNamespaces: false
45+
ContinuationIndentWidth: 2
46+
IndentCaseLabels: true
47+
IndentPPDirectives: BeforeHash
48+
IndentWidth: 2
49+
KeepEmptyLinesAtTheStartOfBlocks: false
50+
MaxEmptyLinesToKeep: 1
51+
NamespaceIndentation: All
52+
ObjCSpaceAfterProperty: true
53+
ObjCSpaceBeforeProtocolList: true
54+
PointerAlignment: Right
55+
ReflowComments: true
56+
SpaceAfterCStyleCast: true
57+
SpaceAfterLogicalNot: false
58+
SpaceAfterTemplateKeyword: true
59+
SpaceBeforeAssignmentOperators: true
60+
SpaceBeforeCpp11BracedList: true
61+
SpaceBeforeCtorInitializerColon: false
62+
SpaceBeforeInheritanceColon: false
63+
SpaceBeforeParens: ControlStatements
64+
SpaceBeforeRangeBasedForLoopColon: true
65+
SpaceInEmptyParentheses: false
66+
SpacesBeforeTrailingComments: 2
67+
SpacesInAngles: Never
68+
SpacesInCStyleCastParentheses: false
69+
SpacesInContainerLiterals: false
70+
SpacesInParentheses: false
71+
SpacesInSquareBrackets: false
72+
TabWidth: 2
73+
Cpp11BracedListStyle: false
74+
UseTab: Never

.codeql-prebuild-cpp-Linux.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# install dependencies for C++ analysis
2+
set -e
3+
4+
# install dependencies
5+
dependencies=(
6+
"bison"
7+
"build-essential"
8+
"clang"
9+
"cmake"
10+
"flex"
11+
"git"
12+
"lld"
13+
"llvm"
14+
)
15+
sudo apt-get update
16+
sudo apt-get install --no-install-recommends -y "${dependencies[@]}"
17+
18+
# build
19+
eval "$(./third-party/nxdk/bin/activate -s)"
20+
make
21+
22+
# skip autobuild
23+
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.codeql-prebuild-cpp-Windows.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# install dependencies for C++ analysis
2+
set -e
3+
4+
# update pacman
5+
pacman --noconfirm -Syu
6+
7+
# install dependencies
8+
dependencies=(
9+
"make"
10+
"cmake"
11+
"git"
12+
"bison"
13+
"flex"
14+
"mingw-w64-x86_64-gcc"
15+
"mingw-w64-x86_64-llvm"
16+
"mingw-w64-x86_64-clang"
17+
"mingw-w64-x86_64-lld"
18+
)
19+
pacman -S --noconfirm "${dependencies[@]}"
20+
21+
# build
22+
eval "$(./third-party/nxdk/bin/activate -s)"
23+
make
24+
25+
# skip autobuild
26+
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.codeql-prebuild-cpp-macOS.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# install dependencies for C++ analysis
2+
set -e
3+
4+
# install dependencies
5+
dependencies=(
6+
"cmake"
7+
"coreutils"
8+
"lld"
9+
"llvm"
10+
)
11+
brew install "${dependencies[@]}"
12+
13+
# build
14+
eval "$(./third-party/nxdk/bin/activate -s)"
15+
make
16+
17+
# skip autobuild
18+
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.github/workflows/ci.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
name: CI
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
push:
13+
branches:
14+
- master
15+
16+
concurrency:
17+
group: "${{ github.workflow }}-${{ github.ref }}"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
setup_release:
22+
name: Setup Release
23+
outputs:
24+
publish_release: ${{ steps.setup_release.outputs.publish_release }}
25+
release_body: ${{ steps.setup_release.outputs.release_body }}
26+
release_commit: ${{ steps.setup_release.outputs.release_commit }}
27+
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
28+
release_tag: ${{ steps.setup_release.outputs.release_tag }}
29+
release_version: ${{ steps.setup_release.outputs.release_version }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Release
36+
id: setup_release
37+
uses: LizardByte/[email protected]
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
build:
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- os: macos-latest
47+
shell: "bash"
48+
- os: ubuntu-latest
49+
shell: "bash"
50+
- os: windows-latest
51+
shell: "msys2 {0}"
52+
53+
name: Build (${{ matrix.os }})
54+
needs: setup_release
55+
runs-on: ${{ matrix.os }}
56+
defaults:
57+
run:
58+
shell: ${{ matrix.shell }}
59+
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
with:
64+
submodules: recursive
65+
66+
- name: Setup Dependencies Linux
67+
if: runner.os == 'Linux'
68+
run: |
69+
dependencies=(
70+
"bison"
71+
"build-essential"
72+
"clang"
73+
"cmake"
74+
"flex"
75+
"git"
76+
"lld"
77+
"llvm"
78+
)
79+
sudo apt-get update
80+
sudo apt-get install --no-install-recommends -y "${dependencies[@]}"
81+
82+
- name: Setup Dependencies macOS
83+
if: runner.os == 'macOS'
84+
run: |
85+
dependencies=(
86+
"cmake"
87+
"coreutils"
88+
"lld"
89+
"llvm"
90+
)
91+
brew install "${dependencies[@]}"
92+
93+
- name: Setup Dependencies Windows
94+
if: runner.os == 'Windows'
95+
uses: msys2/setup-msys2@v2
96+
with:
97+
msystem: MINGW64
98+
update: true
99+
install: >-
100+
make
101+
cmake
102+
git
103+
bison
104+
flex
105+
mingw-w64-x86_64-gcc
106+
mingw-w64-x86_64-llvm
107+
mingw-w64-x86_64-clang
108+
mingw-w64-x86_64-lld
109+
110+
- name: Setup python
111+
id: setup-python
112+
uses: actions/setup-python@v5
113+
with:
114+
python-version: '3.11'
115+
116+
- name: Python Path
117+
id: python-path
118+
run: |
119+
if [ "${{ runner.os }}" = "Windows" ]; then
120+
# replace backslashes with double backslashes
121+
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
122+
else
123+
python_path=${{ steps.setup-python.outputs.python-path }}
124+
fi
125+
126+
# step output
127+
echo "python-path=${python_path}"
128+
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
129+
130+
- name: Build
131+
run: |
132+
eval "$(./third-party/nxdk/bin/activate -s)"
133+
make
134+
135+
# move artifacts
136+
mkdir -p artifacts
137+
mv ./build/default.xbe ./artifacts
138+
mv ./Moonlight.iso ./artifacts
139+
140+
- name: Upload Artifacts
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: moonlight-${{ runner.os }}
144+
path: artifacts/
145+
146+
- name: Run tests
147+
id: test
148+
if: false
149+
working-directory: build/tests
150+
run: |
151+
./test_moonlight-xboxog --gtest_color=yes
152+
153+
- name: Generate gcov report
154+
# any except canceled or skipped
155+
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
156+
id: test_report
157+
working-directory: build
158+
run: |
159+
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
160+
${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \
161+
--exclude-noncode-lines \
162+
--exclude-throw-branches \
163+
--exclude-unreachable-branches \
164+
--verbose \
165+
--xml-pretty \
166+
-o coverage.xml
167+
168+
- name: Debug coverage file
169+
if: >-
170+
always() &&
171+
steps.test_report.outcome == 'success'
172+
run: |
173+
cat build/coverage.xml
174+
175+
# todo: upload coverage in separate job similar to LizardByte/libdisplaydevice
176+
- name: Upload coverage
177+
# any except canceled or skipped
178+
if: >-
179+
always() &&
180+
steps.test_report.outcome == 'success' &&
181+
startsWith(github.repository, 'LizardByte/')
182+
uses: codecov/codecov-action@v4
183+
with:
184+
disable_search: true
185+
fail_ci_if_error: true
186+
files: ./build/coverage.xml
187+
flags: "${{ runner.os }}"
188+
token: ${{ secrets.CODECOV_TOKEN }}
189+
verbose: true
190+
191+
- name: Create/Update GitHub Release
192+
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
193+
uses: LizardByte/[email protected]
194+
with:
195+
allowUpdates: true
196+
body: ${{ needs.setup_release.outputs.release_body }}
197+
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
198+
name: ${{ needs.setup_release.outputs.release_tag }}
199+
prerelease: true
200+
tag: ${{ needs.setup_release.outputs.release_tag }}
201+
token: ${{ secrets.GH_BOT_TOKEN }}

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# JetBrains IDE
35+
.idea/
36+
37+
# VSCode IDE
38+
.vscode/

.gitmodules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[submodule "third-party/moonlight-common-c"]
2+
path = third-party/moonlight-common-c
3+
url = https://github.com/moonlight-stream/moonlight-common-c.git
4+
branch = master
5+
[submodule "third-party/nxdk"]
6+
path = third-party/nxdk
7+
url = https://github.com/XboxDev/nxdk.git
8+
branch = master

0 commit comments

Comments
 (0)