Update CMake configuration for multi-platform support #22
Workflow file for this run
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++ CI | |
on: | |
push: | |
branches: | |
- ak5k-patch-1 | |
# tags: | |
# - '*' | |
env: | |
APPVEYOR: true | |
APPVEYOR_BUILD_NUMBER: ${{ github.run_number }} | |
APPVEYOR_REPO_COMMIT: ${{ github.sha }} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
# cpp_compiler: [g++, clang++] | |
# c_compiler: [gcc, clang] | |
build_type: [Release] | |
include: | |
- os: ubuntu-latest | |
arch: x64_64 | |
- os: ubuntu-latest | |
arch: aarch64 | |
- os: windows-latest | |
arch: x64 | |
build_type: RelWithDebInfo | |
ninja: " -G Ninja " | |
- os: windows-latest | |
arch: x86 | |
ninja: " -G Ninja " | |
- os: macos-latest | |
arch: arm64;x86_64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create Build Environment | |
# Some setup steps may vary depending on the operating system | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
choco install ninja | |
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
: | |
# sudo apt-get update | |
# sudo apt-get install -y cmake ninja-build | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
: | |
# brew install cmake ninja | |
fi | |
- name: VC++ 2022 Environment | |
if: runner.os == 'Windows' | |
working-directory: ${{ github.workspace }} | |
# Execute tests defined by the CMake configuration | |
shell: cmd | |
run: | | |
if "%matrix.arch%"=="x64" ( | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
) else if "%matrix.arch%"=="x86" ( | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" | |
) | |
- name: Configure CMake | |
# Note the current configuration is for a basic C++ project. You'll need to update this for your specific needs. | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
cmake -B ${{ github.workspace }} ${{matrix.ninja}} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -S ${{ github.workspace }} | |
else | |
cmake -B ${{ github.workspace }} ${{matrix.ninja}} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S ${{ github.workspace }} -DCMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}" | |
fi | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{ github.workspace }} --config ${{ matrix.build_type }} | |
- name: CTest | |
working-directory: ${{ github.workspace }} | |
# Execute tests defined by the CMake configuration | |
run: ctest --build-config ${{ matrix.build_type }} | |
- name: CPack | |
working-directory: ${{ github.workspace }} | |
# Execute tests defined by the CMake configuration | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" && | |
"${{ matrix.arch }}" == "x64" ]]; then | |
cpack | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
sudo cpack | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: my-artifact | |
path: | | |
./reaper_*.dll | |
./reaper_*.pdb | |
./reaper_*.exe | |
./reaper_*.pkg | |
./reaper_*.dylib | |
./reaper_*.so | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: false | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: my-artifact | |
path: ./artifacts | |
- name: Upload Release Asset | |
run: | | |
for file in ./artifacts/*; do | |
if [ -f "$file" ]; then | |
echo "Uploading $file" | |
curl \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: $(file -b --mime-type $file)" \ | |
--data-binary @"$file" \ | |
"${{ steps.create_release.outputs.upload_url }}?name=$(basename $file)" | |
fi | |
done |