update extensions #90
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: build and test code | |
on: | |
push: | |
branches: [ "main"] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build_linux: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install gtest manually | |
run: sudo apt-get install libgtest-dev | |
- name: Create a temporary artifact downloads folder | |
working-directory: ${{github.workspace}}/ | |
run: mkdir linux_binary_dir | |
## Do all the Build stuff for Linux | |
- name: Configure CMake 4 Linux | |
run: cmake -B ${{github.workspace}}/code/build -S${{github.workspace}}/code -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build 4 Linux | |
run: cmake --build ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} | |
- name: Install 4 Linux | |
run: cmake --install ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/linux_binary_dir | |
- name: Test | |
working-directory: ${{github.workspace}}/code/build | |
run: ctest -C ${{env.BUILD_TYPE}} | |
- uses: actions/upload-artifact@master | |
with: | |
name: linux_binaries | |
path: linux_binary_dir | |
build_windows: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install windows compiler | |
run: sudo apt-get install mingw-w64 | |
- name: Create a temporary artifact downloads folder | |
working-directory: ${{github.workspace}}/ | |
run: mkdir windows_binary_dir | |
## Do all the Build stuff for Windows | |
- name: Configure CMake 4 Windows | |
run: cmake -B ${{github.workspace}}/code/build -S${{github.workspace}}/code -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --toolchain ${{github.workspace}}/code/mingw-w64-x86_64.cmake | |
- name: Build 4 Windows | |
run: cmake --build ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} | |
- name: Install 4 Windows | |
run: cmake --install ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/windows_binary_dir | |
- uses: actions/upload-artifact@master | |
with: | |
name: windows_binaries | |
path: windows_binary_dir | |
build_macos: | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install gtest manually | |
run: brew install googletest | |
- name: Create a temporary artifact downloads folder | |
working-directory: ${{github.workspace}}/ | |
run: mkdir macos_binary_dir | |
## Do all the Build stuff for Mac | |
- name: Configure CMake 4 MacOS | |
run: cmake -B ${{github.workspace}}/code/build -S${{github.workspace}}/code -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build 4 Mac | |
run: cmake --build ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} | |
- name: Install 4 MAC | |
run: cmake --install ${{github.workspace}}/code/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/macos_binary_dir | |
- name: Test | |
working-directory: ${{github.workspace}}/code/build | |
run: ctest -C ${{env.BUILD_TYPE}} | |
- uses: actions/upload-artifact@master | |
with: | |
name: macos_binaries | |
path: macos_binary_dir | |
create_release: | |
needs: [build_linux, build_windows, build_macos] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: linux_binaries | |
path: linux_binary_dir | |
- uses: actions/download-artifact@master | |
with: | |
name: windows_binaries | |
path: windows_binary_dir | |
- uses: actions/download-artifact@master | |
with: | |
name: macos_binaries | |
path: macos_binary_dir | |
- name: rename binaries | |
if: ${{ github.ref == 'refs/heads/main' }} # pre release only on main | |
run: | | |
mv linux_binary_dir/demo_1_main linux_binary_dir/demo_1_main_linux \ | |
&& mv macos_binary_dir/demo_1_main macos_binary_dir/demo_1_main_macos \ | |
&& mv windows_binary_dir/demo_1_main.exe windows_binary_dir/demo_1_main_windows.exe | |
# create pre-release | |
- name: create a pre-release | |
if: ${{ github.ref == 'refs/heads/main' }} # pre release only on main | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Exam 1 Package" | |
files: | | |
linux_binary_dir/* | |
windows_binary_dir/* | |
macos_binary_dir/* |