ci: fix case #91
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: CMake | |
on: [push] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build-agsworks: | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- { name: linux, os: ubuntu-latest} | |
- { name: windows, os: windows-latest} | |
- { name: macOS, os: macOS-latest} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Configure CMake | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
working-directory: ${{runner.workspace}}/build | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] || [ "$RUNNER_OS" == "macOS" ]; then | |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
cmake -S $GITHUB_WORKSPACE -B . -G "Visual Studio 17 2022" -A Win32 | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi | |
- name: Build | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] || [ "$RUNNER_OS" == "macOS" ]; then | |
cmake --build . --config $BUILD_TYPE | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
cmake --build . --config $BUILD_TYPE | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi | |
# - name: Test | |
# working-directory: ${{runner.workspace}}/build | |
# shell: bash | |
# # Execute tests defined by the CMake configuration. | |
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: | | |
# if [ "$RUNNER_OS" == "Linux" ] || [ "$RUNNER_OS" == "macOS" ]; then | |
# ctest -C $BUILD_TYPE | |
# elif [ "$RUNNER_OS" == "Windows" ]; then | |
# ctest -C Debug | |
# else | |
# echo "$RUNNER_OS not supported" | |
# exit 1 | |
# fi | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: agsworks-${{ matrix.platform.name }} | |
path: | | |
${{runner.workspace}}/build/Debug/*.dll | |
${{runner.workspace}}/build/Release/*.dll | |
${{runner.workspace}}/build/*.so | |
${{runner.workspace}}/build/*.dylib | |
release-agsworks: | |
needs: build-agsworks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download built plugin artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: agsworks-release | |
pattern: agsworks-* | |
merge-multiple: true | |
- run: ls -R agsworks-release | |
- name: Package plugin for release | |
run: | | |
mkdir AGSWorksPlugin | |
mkdir AGSWorksPlugin/Windows | |
mkdir AGSWorksPlugin/Windows/x86 | |
mkdir AGSWorksPlugin/Linux | |
mkdir AGSWorksPlugin/Linux/x64 | |
mkdir AGSWorksPlugin/macOS | |
mv agsworks-release/$BUILD_TYPE/AGSWorks.dll AGSWorksPlugin/Windows/x86/AGSWorks.dll | |
mv agsworks-release/libAGSWorks.so AGSWorksPlugin/Linux/x64/libAGSWorks.so | |
mv agsworks-release/libAGSWorks.dylib AGSWorksPlugin/macOS/libAGSWorks.dylib | |
zip -r AGSWorksPlugin.zip AGSWorksPlugin | |
- name: Create release and upload assets | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: | | |
AGSWorksPlugin.zip | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |