add mac OS build to CI #59
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 multiple platforms | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
build_type: [Release] | |
c_compiler: [gcc, cl] | |
include: | |
- os: windows-latest | |
c_compiler: cl | |
- os: ubuntu-latest | |
c_compiler: gcc | |
- os: macos-latest | |
c_compiler: gcc | |
exclude: | |
- os: windows-latest | |
c_compiler: gcc | |
- os: ubuntu-latest | |
c_compiler: cl | |
- os: macos-latest | |
c_compiler: cl | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set reusable strings | |
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
echo "build-input-dir=${{ github.workspace }}/mumble" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
-S ${{ steps.strings.outputs.build-input-dir }} | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: build | |
path: ${{ steps.strings.outputs.build-output-dir }} | |
bundle: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: build | |
- name: Bundle | |
run: | | |
mv build/Release/plugin.dll plugin.dll | |
mv build/libfactorio_linux_x86_64.so libplugin.so | |
mv build/libfactorio_macos_x86_64.dylib libplugin.dylib | |
mv mumble/manifest.xml manifest.xml | |
zip -MM factorio.mumble_plugin manifest.xml plugin.dll libplugin.so libplugin.dylib | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: bundle | |
path: factorio.mumble_plugin |