Building openFrameworks projects with Github Actions

Hi everyone!

For the project I am working on, I wanted to have it being built with Github Actions. Since i could not find any info on how to do that, apart from the Travis build scripts for openFrameworks, here is what I have done.

A few notes on the configuration:

  • Currently only OSX and Linux
  • Every extra addon, has to be checked out, look for the “Addons: …” comment.
  • Extra makefile for Linux, which contains the correct paths for the build server
name: build

on:
  # push:
  #   branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build-ubuntu:
    runs-on: ubuntu-latest

    steps:
      # Checking out our iva repo into the folder "iva"
      - name: Checkout
        uses: actions/checkout@v2
        with:
          path: iva
      
      # Checking out openFrameworks with submodules into the folder "ofx"
      - name: Checkout openFrameworks
        uses: actions/checkout@v2
        with:
          repository:  openframeworks/openFrameworks
          path: ofx
          submodules: true
      
      # Addons: Checking out additional addons into the correct openFrameworks directory
      - name: Checkout ofxCv addon
        uses: actions/checkout@v2
        with:
          repository:  kylemcdonald/ofxCv
          path: ofx/addons/ofxCv
      - name: Checkout ofxMidi addon
        uses: actions/checkout@v2
        with:
          repository:  danomatika/ofxMidi
          path: ofx/addons/ofxMidi
      
      # Install dependencies in order to be able to compile the project.
      - name: Install ofx dependencies
        run: sudo bash ./ofx/scripts/linux/ubuntu/install_dependencies.sh -y

      # Downloading additional libs for ofx
      - name: Download ofx libs
        run: bash ./ofx/scripts/linux/download_libs.sh

      # Build openFrameworks
      - name: Building openFrameworks
        run: bash ./ofx/scripts/linux/compileOF.sh

      # Building the project
      - name: Building IVA
        run: |
          export OF_ROOT=${{ github.workspace }}/ofx
          cd ./iva/ivaApp
          make -f Makefile.github-action

      # Upload executable binaries to GitHub
      - name: Uploading artifacts
        uses: actions/upload-artifact@v2
        with:
          name: Linux Artifacts
          path: ./iva/ivaApp/bin/

  build-mac:
    # the build server's operating system
    runs-on: macos-latest

    steps:
      # Checking out our iva repo into the folder "iva"
      - name: Checkout
        uses: actions/checkout@v2
        with:
          path: iva
      
      # Checking out openFrameworks with submodules into the folder "ofx"
      - name: Checkout openFrameworks
        uses: actions/checkout@v2
        with:
          repository:  openframeworks/openFrameworks
          path: ofx
          submodules: true
      
      # Addons: Checking out additional addons into the correct openFrameworks directory
      - name: Checkout ofxCv addon
        uses: actions/checkout@v2
        with:
          repository:  kylemcdonald/ofxCv
          path: ofx/addons/ofxCv
      - name: Checkout ofxMidi addon
        uses: actions/checkout@v2
        with:
          repository:  danomatika/ofxMidi
          path: ofx/addons/ofxMidi

      # Downloading additional libs for ofx
      - name: Download ofx libs
        run: bash ./ofx/scripts/osx/download_libs.sh

      - name: Install project generator
        run: |
          cd ./ofx/
          echo "Downloading projectGenerator from ci server"
          wget http://ci.openframeworks.cc/projectGenerator/projectGenerator-osx.zip
          unzip projectGenerator-osx.zip
          rm projectGenerator-osx.zip

      - name: Create project files for xcode
        run: |
          ./ofx/projectGenerator-osx/projectGenerator.app/Contents/Resources/app/app/projectGenerator -o"./ofx" -p"osx" ./iva/ivaApp

      # Building the project
      - name: Building IVA
        run: |
          cd ./iva/ivaApp
          ls -la
          xcodebuild -configuration Release -target ivaApp -project "ivaApp.xcodeproj"

      # Upload executable binaries to GitHub
      - name: Uploading artifacts
        uses: actions/upload-artifact@v2
        with:
          name: Mac Os Artifacts
          path: ./iva/ivaApp/bin/

Best
Markus

2 Likes