CI #45
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: CI | |
on: | |
workflow_dispatch: | |
create: # when tags are created | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
native_builds: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
build_args: release win-x64 | |
build_target: win-x64 | |
artifact_name: build\Release\win-x64\libveldrid-spirv.dll | |
- os: windows-latest | |
build_args: Release win-x86 | |
build_target: win-x86 | |
artifact_name: build\Release\win-x86\libveldrid-spirv.dll | |
- os: windows-latest | |
build_args: release android arm64-v8a --android-ndk '%ANDROID_NDK_HOME%' | |
build_target: android-arm64-v8a | |
artifact_name: build\Release\android-arm64-v8a\libveldrid-spirv.so | |
- os: windows-latest | |
build_args: release android x86_64 --android-ndk '%ANDROID_NDK_HOME%' | |
build_target: android-x86_64 | |
artifact_name: build\Release\android-x86_64\libveldrid-spirv.so | |
- os: windows-latest | |
build_args: release android armeabi-v7a --android-ndk '%ANDROID_NDK_HOME%' | |
build_target: android-armeabi-v7a | |
artifact_name: build\Release\android-armeabi-v7a\libveldrid-spirv.so | |
- os: ubuntu-20.04 | |
build_args: release linux-x64 | |
build_target: linux-x64 | |
artifact_name: build/Release/linux-x64/libveldrid-spirv.so | |
- os: macos-11 | |
build_args: release osx 'arm64;x86_64' | |
build_target: osx | |
artifact_name: build/Release/osx/libveldrid-spirv.dylib | |
- os: macos-latest | |
build_args: release ios | |
build_target: ios | |
artifact_name: build/Release/ios/veldrid-spirv.xcframework.zip | |
name: ${{ matrix.build_target }} Native Build | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get Submodules | |
run: git submodule update --init --recursive | |
- name: Sync Third Party | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
./ext/sync-shaderc.cmd | |
else | |
./ext/sync-shaderc.sh | |
fi | |
shell: bash | |
- name: Build ${{ matrix.build_target }} Native Library | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
./build-native.cmd ${{ matrix.build_args }} | |
else | |
./build-native.sh ${{ matrix.build_args }} | |
fi | |
shell: bash | |
- name: Compress iOS Framework For Upload | |
if: ${{ matrix.build_target == 'ios' }} | |
run: | | |
cp -r build/Release/ios/veldrid-spirv.xcframework ./ | |
zip -r ${{ matrix.artifact_name }} veldrid-spirv.xcframework | |
# We can only run per-platform tests on 64-bit architectures | |
# https://github.com/actions/setup-dotnet/issues/72 | |
- name: Install .NET | |
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }} | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore Dependencies | |
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }} | |
run: dotnet restore src | |
- name: Run Tests | |
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }} | |
run: dotnet run -p src/Veldrid.SPIRV.Tests/Veldrid.SPIRV.Tests.csproj -c Release --no-restore | |
- name: Upload ${{ matrix.build_target }} Native Library | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.build_target }} | |
path: ${{ matrix.artifact_name }} | |
if-no-files-found: error | |
managed_build: | |
runs-on: windows-latest | |
needs: native_builds | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Download win-x64 | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x64 | |
path: build/Release/win-x64 | |
- name: Download win-x86 | |
uses: actions/download-artifact@v2 | |
with: | |
name: win-x86 | |
path: build/Release/win-x86 | |
- name: Download android-arm64-v8a | |
uses: actions/download-artifact@v2 | |
with: | |
name: android-arm64-v8a | |
path: build/Release/android-arm64-v8a | |
- name: Download android-x86_64 | |
uses: actions/download-artifact@v2 | |
with: | |
name: android-x86_64 | |
path: build/Release/android-x86_64 | |
- name: Download android-armeabi-v7a | |
uses: actions/download-artifact@v2 | |
with: | |
name: android-armeabi-v7a | |
path: build/Release/android-armeabi-v7a | |
- name: Download linux-x64 | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-x64 | |
path: build/Release/linux-x64 | |
- name: Download osx | |
uses: actions/download-artifact@v2 | |
with: | |
name: osx | |
path: build/Release/osx | |
- name: Download ios | |
uses: actions/download-artifact@v2 | |
with: | |
name: ios | |
path: build/Release/ios | |
- name: Uncompress iOS Framework | |
run: | | |
unzip -qq build/Release/ios/veldrid-spirv.xcframework.zip -d build/Release/ios | |
rm build/Release/ios/veldrid-spirv.xcframework.zip | |
- name: Install .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore Dependencies | |
run: dotnet restore src | |
- name: Build NuGet Package | |
run: dotnet pack src/Veldrid.SPIRV -c Release --no-restore | |
- name: Upload NuGet Package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nuget_package | |
path: bin\Packages\Release\*.nupkg | |
if-no-files-found: error | |
- name: Publish to nuget.org | |
if: startsWith(github.ref, 'refs/tags/') | |
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} | |