Skip to content

Trying to fix build on macOS #51

Trying to fix build on macOS

Trying to fix build on macOS #51

Workflow file for this run

name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: ["closed"]
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
check_formatting:
runs-on: ubuntu-latest
steps:
# Check out the repository (basically downloads the source code)
- uses: actions/checkout@v3
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Call clang-format
run: find src/ -name \*.c -o -name \*.h -print0 | xargs -0 -n 1 clang-format -n --Werror -n --verbose
build_and_publish:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
# Check out the repository (basically downloads the source code)
- uses: actions/checkout@v3
# Setup specific for Windows - don't forget to use the msys2 shell in other steps!
- name: Install MingW stuff
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
path-type: inherit
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-cmake
mingw-w64-x86_64-glib2
mingw-w64-x86_64-libpng
mingw-w64-x86_64-openmp
# Handle OpenMP on macOS
- name: OpenMP stuff for macOS
if: matrix.os == 'macos-latest'
run: |
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
- name: Configure CMake (non-windows)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Configure CMake (windows)
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: |
mkdir build
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# Build your program with the given configuration
- name: Build (non-windows)
if: matrix.os != 'windows-latest'
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Build (windows)
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: cmake --build build --config ${{env.BUILD_TYPE}}
# Create Artifact
- name: Create Artifact (non-windows)
run: |
mkdir ${{ matrix.os }}-release
cp build/Mandelbrot* ${{ matrix.os }}-release/
if: matrix.os != 'windows-latest'
- name: Create Artifact (windows)
shell: msys2 {0}
run: |
mkdir ${{ matrix.os }}-release
cp build/Mandelbrot.exe ${{ matrix.os }}-release/
if: matrix.os == 'windows-latest'
# ZIP Artifact
- name: ZIP Artifact (non-windows)
run: |
zip -r ${{ matrix.os }}.zip ${{ matrix.os }}-release/
if: matrix.os != 'windows-latest'
- name: ZIP Artifact (windows)
shell: msys2 {0}
run: |
7z a "${{ matrix.os }}.zip" "${{ matrix.os }}-release/"
if: matrix.os == 'windows-latest'
# Publish Artifact
- name: Publish Artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: ${{ matrix.os }}
path: ${{ matrix.os }}.zip
release:
name: "Release"
needs: build_and_publish
runs-on: ubuntu-latest
steps:
# We don't need the repo, grab all artifacts from the build stage
- uses: actions/download-artifact@v2
- name: Display fetched artifacts
run: ls -R
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Latest (development) Build"
files: |
ubuntu-latest/ubuntu-latest.zip
macos-latest/macos-latest.zip
windows-latest/windows-latest.zip