Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 15, 2024
1 parent c9dd12f commit 697ac6e
Show file tree
Hide file tree
Showing 12 changed files with 424 additions and 2 deletions.
74 changes: 74 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
# This file is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlignTrailingComments: false
AlwaysBreakAfterReturnType: All
AlwaysBreakTemplateDeclarations: MultiLine
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 2
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 2
Cpp11BracedListStyle: false
UseTab: Never
23 changes: 23 additions & 0 deletions .codeql-prebuild-cpp-Linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# install dependencies for C++ analysis
set -e

# install dependencies
dependencies=(
"bison"
"build-essential"
"clang"
"cmake"
"flex"
"git"
"lld"
"llvm"
)
sudo apt-get update
sudo apt-get install --no-install-recommends -y "${dependencies[@]}"

# build
eval "$(./third-party/nxdk/bin/activate -s)"
make

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
26 changes: 26 additions & 0 deletions .codeql-prebuild-cpp-Windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# install dependencies for C++ analysis
set -e

# update pacman
pacman --noconfirm -Syu

# install dependencies
dependencies=(
"make"
"cmake"
"git"
"bison"
"flex"
"mingw-w64-x86_64-gcc"
"mingw-w64-x86_64-llvm"
"mingw-w64-x86_64-clang"
"mingw-w64-x86_64-lld"
)
pacman -S --noconfirm "${dependencies[@]}"

# build
eval "$(./third-party/nxdk/bin/activate -s)"
make

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
18 changes: 18 additions & 0 deletions .codeql-prebuild-cpp-macOS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# install dependencies for C++ analysis
set -e

# install dependencies
dependencies=(
"cmake"
"coreutils"
"lld"
"llvm"
)
brew install "${dependencies[@]}"

# build
eval "$(./third-party/nxdk/bin/activate -s)"
make

# skip autobuild
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
201 changes: 201 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
---
name: CI

on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
push:
branches:
- master

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
setup_release:
name: Setup Release
outputs:
publish_release: ${{ steps.setup_release.outputs.publish_release }}
release_body: ${{ steps.setup_release.outputs.release_body }}
release_commit: ${{ steps.setup_release.outputs.release_commit }}
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
release_tag: ${{ steps.setup_release.outputs.release_tag }}
release_version: ${{ steps.setup_release.outputs.release_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Release
id: setup_release
uses: LizardByte/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
shell: "bash"
- os: ubuntu-latest
shell: "bash"
- os: windows-latest
shell: "msys2 {0}"

name: Build (${{ matrix.os }})
needs: setup_release
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Dependencies Linux
if: runner.os == 'Linux'
run: |
dependencies=(
"bison"
"build-essential"
"clang"
"cmake"
"flex"
"git"
"lld"
"llvm"
)
sudo apt-get update
sudo apt-get install --no-install-recommends -y "${dependencies[@]}"
- name: Setup Dependencies macOS
if: runner.os == 'macOS'
run: |
dependencies=(
"cmake"
"coreutils"
"lld"
"llvm"
)
brew install "${dependencies[@]}"
- name: Setup Dependencies Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
make
cmake
git
bison
flex
mingw-w64-x86_64-gcc
mingw-w64-x86_64-llvm
mingw-w64-x86_64-clang
mingw-w64-x86_64-lld
- name: Setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Python Path
id: python-path
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
# replace backslashes with double backslashes
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
else
python_path=${{ steps.setup-python.outputs.python-path }}
fi
# step output
echo "python-path=${python_path}"
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
- name: Build
run: |
eval "$(./third-party/nxdk/bin/activate -s)"
make
# move artifacts
mkdir -p artifacts
mv ./build/default.xbe ./artifacts
mv ./Moonlight.iso ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: moonlight-${{ runner.os }}
path: artifacts/

- name: Run tests
id: test
if: false
working-directory: build/tests
run: |
./test_moonlight-xboxog --gtest_color=yes
- name: Generate gcov report
# any except canceled or skipped
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
id: test_report
working-directory: build
run: |
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml
- name: Debug coverage file
if: >-
always() &&
steps.test_report.outcome == 'success'
run: |
cat build/coverage.xml
# todo: upload coverage in separate job similar to LizardByte/libdisplaydevice
- name: Upload coverage
# any except canceled or skipped
if: >-
always() &&
steps.test_report.outcome == 'success' &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: true
files: ./build/coverage.xml
flags: "${{ runner.os }}"
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
uses: LizardByte/[email protected]
with:
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
name: ${{ needs.setup_release.outputs.release_tag }}
prerelease: true
tag: ${{ needs.setup_release.outputs.release_tag }}
token: ${{ secrets.GH_BOT_TOKEN }}
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# JetBrains IDE
.idea/

# VSCode IDE
.vscode/
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "third-party/moonlight-common-c"]
path = third-party/moonlight-common-c
url = https://github.com/moonlight-stream/moonlight-common-c.git
branch = master
[submodule "third-party/nxdk"]
path = third-party/nxdk
url = https://github.com/XboxDev/nxdk.git
branch = master
Loading

0 comments on commit 697ac6e

Please sign in to comment.