Merge remote-tracking branch 'NeosSharedProject/master' into pr/kazu0… #37
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: C/C++ CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
permissions: | |
contents: write # to fetch code (actions/checkout),and release | |
jobs: | |
job: | |
name: ${{ matrix.name }}-build-and-test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter] | |
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. | |
include: | |
- name: windows-latest-cl.exe | |
os: windows-latest | |
cxx: cl.exe | |
cc: cl.exe | |
- name: ubuntu-latest-clang++ | |
os: ubuntu-latest | |
cxx: clang++ | |
cc: clang | |
- name: macos-latest-clang++ | |
os: macos-latest | |
cxx: clang++ | |
cc: clang | |
- name: ubuntu-latest-g++ | |
os: ubuntu-latest | |
cxx: g++ | |
cc: gcc | |
- name: ubuntu-gcc-hunter | |
os: ubuntu-latest | |
toolchain: ninja-gcc-cxx17-fpic | |
- name: macos-clang-hunter | |
os: macos-latest | |
toolchain: ninja-clang-cxx17-fpic | |
- name: windows-msvc-hunter | |
os: windows-latest | |
toolchain: ninja-vs-win64-cxx17 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: lukka/get-cmake@latest | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Set Compiler Environment | |
if: endsWith(matrix.name, 'hunter') != true | |
run: | | |
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV | |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV | |
- name: Set Compiler Environment for Hunter on Windows | |
if: startsWith(matrix.name, 'windows') && endsWith(matrix.name, 'hunter') | |
run: | | |
echo "VS160COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools" >> $GITHUB_ENV | |
- name: Checkout Hunter toolchains | |
if: endsWith(matrix.name, 'hunter') | |
uses: actions/checkout@v4 | |
with: | |
repository: cpp-pm/polly | |
path: cmake/polly | |
- name: Cache DX SDK | |
id: dxcache | |
if: contains(matrix.name, 'windows') | |
uses: actions/cache@v3 | |
with: | |
path: '${{ github.workspace }}/DX_SDK' | |
key: ${{ runner.os }}-DX_SDK | |
restore-keys: | | |
${{ runner.os }}-DX_SDK | |
- name: Download DXSetup | |
if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true' | |
run: | | |
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe | |
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK" | |
- name: Set Windows specific CMake arguments | |
if: contains(matrix.name, 'windows') | |
id: windows_extra_cmake_args | |
run: echo "args=-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1" >> $GITHUB_OUTPUT | |
- name: configure and build | |
uses: lukka/run-cmake@v3 | |
env: | |
DXSDK_DIR: '${{ github.workspace }}/DX_SDK' | |
with: | |
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced | |
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' | |
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }}' | |
buildWithCMakeArgs: '--parallel 24 -v' | |
buildDirectory: '${{ github.workspace }}/build/' | |
- name: test | |
run: cd build/bin && ./unit | |
shell: bash | |
- uses: actions/upload-artifact@v3 | |
name: upload-artifact-for-windows | |
if: contains(matrix.name,'windows') | |
with: | |
name: 'assimp-bins-${{ matrix.name }}' | |
path: build/bin/* | |
create-release: | |
needs: [job] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}' | |
with: | |
tag_name: '${{github.ref}}' | |
release_name: 'Release ${{github.ref}}' | |
draft: false | |
prerelease: true | |
- run: | | |
echo '${{steps.create-release.outputs.upload_url}}' > release_upload_url.txt | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: create-release | |
path: release_upload_url.txt | |
upload-release: | |
strategy: | |
matrix: | |
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter] | |
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. | |
include: | |
- name: windows-latest-cl.exe | |
os: windows-latest | |
cxx: cl.exe | |
cc: cl.exe | |
- name: ubuntu-latest-clang++ | |
os: ubuntu-latest | |
cxx: clang++ | |
cc: clang | |
- name: macos-latest-clang++ | |
os: macos-latest | |
cxx: clang++ | |
cc: clang | |
- name: ubuntu-latest-g++ | |
os: ubuntu-latest | |
cxx: g++ | |
cc: gcc | |
- name: ubuntu-gcc-hunter | |
os: ubuntu-latest | |
toolchain: ninja-gcc-cxx17-fpic | |
- name: macos-clang-hunter | |
os: macos-latest | |
toolchain: ninja-clang-cxx17-fpic | |
- name: windows-msvc-hunter | |
os: windows-latest | |
toolchain: ninja-vs-win64-cxx17 | |
needs: [create-release] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v1 | |
with: | |
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' | |
- uses: softprops/action-gh-release@v1 | |
with: | |
name: create-release | |
files: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' | |
tag_name: master | |