Skip to content

Commit

Permalink
Merge pull request #1 from natevm/master
Browse files Browse the repository at this point in the history
integrating changes from upstream...
  • Loading branch information
natevm authored Dec 8, 2024
2 parents b5e3ca5 + 7b220e3 commit 469d6c3
Show file tree
Hide file tree
Showing 1,707 changed files with 218,372 additions and 163,659 deletions.
41 changes: 41 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
BasedOnStyle: LLVM

# Whitespace
MaxEmptyLinesToKeep: 2
IndentWidth: 4
ColumnLimit: 100

# Preprocessor
AlignEscapedNewlines: Left
IncludeBlocks: Regroup

# Functions
AllowAllArgumentsOnNextLine: false
BinPackArguments: false
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: false
PenaltyReturnTypeOnItsOwnLine: 9999999
PenaltyBreakBeforeFirstCallParameter: 6
AllowShortFunctionsOnASingleLine: Inline

# Brackets and braces
AlignAfterOpenBracket: AlwaysBreak
BreakBeforeBraces: Allman

# Pointers
PointerAlignment: Left

# Classes
PackConstructorInitializers: NextLineOnly
BreakConstructorInitializers: BeforeComma
AccessModifierOffset: -4

# Switch statements
IndentCaseBlocks: true

# Templates
SpaceAfterTemplateKeyword: false
AlwaysBreakTemplateDeclarations: true

# Misc
SortUsingDeclarations: false
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @shader-slang/dev
/docs/proposals @tangent-vector @csyonghe @expipiplus1
42 changes: 24 additions & 18 deletions .github/actions/common-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ inputs:
runs:
using: composite
steps:
- name: Add bash to PATH
shell: pwsh
if: ${{inputs.os == 'windows'}}
run: |
Add-Content -Path $env:GITHUB_PATH -Value "C:\\Program Files\\Git\\bin"
Add-Content -Path $env:GITHUB_PATH -Value "C:\\Program Files\\Git\\usr\\bin"
- name: Set up MSVC dev tools on Windows
uses: ilammy/msvc-dev-cmd@v1
with:
Expand Down Expand Up @@ -59,14 +66,20 @@ runs:
# Some useful variables
config=${{inputs.config}}
Config=$(echo "${{inputs.config}}" | sed 's/debug/Debug/;s/release/Release/')
bin_dir=$(pwd)/build/$Config/bin
lib_dir=$(pwd)/build/$Config/lib
cmake_config=$(echo "${{inputs.config}}" | sed '
s/^debug$/Debug/
s/^release$/Release/
s/^releaseWithDebugInfo$/RelWithDebInfo/
s/^minSizeRelease$/MinSizeRel/
')
bin_dir=$(pwd)/build/$cmake_config/bin
lib_dir=$(pwd)/build/$cmake_config/lib
echo "config=$config" >> "$GITHUB_ENV"
echo "cmake_config=$cmake_config" >> "$GITHUB_ENV"
echo "bin_dir=$bin_dir" >> "$GITHUB_ENV"
echo "lib_dir=$lib_dir" >> "$GITHUB_ENV"
# Try to restore a LLVM install, and build it otherwise
# Try to restore an LLVM install, and build it otherwise
- uses: actions/cache/restore@v4
id: cache-llvm
if: inputs.build-llvm == 'true'
Expand All @@ -77,25 +90,17 @@ runs:
- name: Build LLVM
if: inputs.build-llvm == 'true' && steps.cache-llvm.outputs.cache-hit != 'true'
shell: bash
run: ./external/build-llvm.sh --install-prefix "${{ github.workspace }}/build/llvm-project-install"
run: |
./external/build-llvm.sh \
--install-prefix "${{github.workspace}}/build/llvm-project-install" \
--repo "https://${{github.token}}@github.com/llvm/llvm-project"
- uses: actions/cache/save@v4
if: inputs.build-llvm == 'true' && steps.cache-llvm.outputs.cache-hit != 'true'
with:
path: ${{ github.workspace }}/build/llvm-project-install
key: ${{ steps.cache-llvm.outputs.cache-primary-key }}

# Run this after building llvm, it's pointless to fill the caches with
# infrequent llvm build products
- name: Set up sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{inputs.os}}-${{inputs.compiler}}-${{inputs.platform}}-${{inputs.config}}
variant: sccache
# Opportunistically use sccache, it's not available for example on self
# hosted runners or ARM
continue-on-error: true

- name: Set environment variable for CMake
- name: Set environment variable for CMake and sccache
shell: bash
run: |
if [ "${{inputs.build-llvm}}" == "true" ]; then
Expand All @@ -108,9 +113,10 @@ runs:
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
fi
echo SCCACHE_IGNORE_SERVER_IO_ERROR=1 >> "$GITHUB_ENV"
# Install swiftshader
- uses: robinraju/release-downloader@v1.8
- uses: robinraju/release-downloader@v1.11
continue-on-error: true
with:
latest: true
Expand Down
37 changes: 37 additions & 0 deletions .github/actions/format-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Formatting tools setup

description: Performs setup common to the code formatting actions

runs:
using: composite
steps:
- name: install gersemi
shell: bash
run: |
pip3 install gersemi colorama
- name: install clang-format
shell: bash
run: |
tmpdir=$(mktemp -d)
curl -L -H "Authorization: token ${{github.token}}" \
-o "$tmpdir/clang-format" \
https://github.com/shader-slang/slang-binaries/raw/306d22efc0f5f72c7230b0b6b7c99f03c46995bd/clang-format/x86_64-linux/bin/clang-format
chmod +x "$tmpdir/clang-format"
echo "$tmpdir" >> $GITHUB_PATH
- name: install prettier
shell: bash
run: |
npm install -g prettier@3.3.3
echo "$(npm bin -g)" >> $GITHUB_PATH
- name: install shfmt
shell: bash
run: |
tmpdir=$(mktemp -d)
curl -L -H "Authorization: token ${{github.token}}" \
-o "$tmpdir/shfmt" \
https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_amd64
chmod +x "$tmpdir/shfmt"
echo "$tmpdir" >> $GITHUB_PATH
30 changes: 16 additions & 14 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ on:
push:
branches: [master]
paths-ignore:
- 'docs/**'
- 'LICENCE'
- 'CONTRIBUTION.md'
- 'README.md'
- "docs/**"
- "LICENSES/**"
- "LICENSE"
- "CONTRIBUTING.md"
- "README.md"
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
- 'LICENCE'
- 'CONTRIBUTION.md'
- 'README.md'
- "docs/**"
- "LICENSES/**"
- "LICENSE"
- "CONTRIBUTING.md"
- "README.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -23,10 +25,10 @@ jobs:
build:
runs-on: [Windows, self-hosted]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: '0'
submodules: "recursive"
fetch-depth: "0"
- name: Common setup
uses: ./.github/actions/common-setup
with:
Expand All @@ -39,10 +41,10 @@ jobs:
run: |
cmake --preset default --fresh -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM -DCMAKE_COMPILE_WARNING_AS_ERROR=false
cmake --workflow --preset release
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'shader-slang/MDL-SDK'
path: 'external/MDL-SDK'
repository: "shader-slang/MDL-SDK"
path: "external/MDL-SDK"
- name: Run benchmark
run: |
cd tools/benchmark
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Formatting (comment /format to auto-fix)

on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/format-setup
- run: ./extras/formatting.sh --check-only
13 changes: 13 additions & 0 deletions .github/workflows/check-toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check Table of Contents (comment /regenerate-toc to auto-fix)

on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./docs/build_toc.sh --check-only
Loading

0 comments on commit 469d6c3

Please sign in to comment.