Update README.md #49
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: | |
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: | |
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 | |
# 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 |