Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: jarod42 on September 28, 2020, 06:50:53 pm

Title: github action [Resolved]
Post by: jarod42 on September 28, 2020, 06:50:53 pm
Do you know how to set up a github action to use CB?

I got

> Error: Unable to initialize GTK+, is DISPLAY set properly?

when using

Code
codeblocks --no-splash-screen --target=Release --build Project.workspace
Title: Re: github action
Post by: oBFusCATed on September 28, 2020, 08:56:27 pm
You can't. Using the build system of cb on headless linux is not possible at the moment.
Title: Re: github action
Post by: BlueHazzard on September 29, 2020, 04:22:33 pm
Can you install some dummy x server? I have Xvfb on my headless server and it works (somehow, there are still some quirks)
Title: Re: github action
Post by: jarod42 on December 08, 2020, 05:33:09 pm
Just found GabrielBB/xvfb-action (https://github.com/GabrielBB/xvfb-action)
which allows to run CB:

Notice that default.conf has also to be provided.

result is similar to:

Code
name: ubuntu-codeblocks

on: [push, pull_request]

jobs:
  linux:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: apt-get update
      run: sudo apt-get update -y

    - name: apt-get install -y codeblocks
      run: sudo apt-get install -y codeblocks

    - name: codeblocks's default configuration
      run: |
        mkdir -p ~/.config/codeblocks
        cp codeblocks/default.conf ~/.config/codeblocks/

    - name: build projects
      uses: GabrielBB/xvfb-action@v1 # fake X-server as codeblocks requires displays :/
      with:
        run: codeblocks --no-splash-screen --target=Release --build Project.workspace
 


my action (https://github.com/Jarod42/premake-sample-projects/blob/master/.github/workflows/premake4-ubuntu-codeblocks.yml)