Skip to content

Enable -fPIC

Enable -fPIC #39

name: Build and Release Addon
on:
workflow_dispatch:
pull_request:
release:
types: [published]
jobs:
build:
strategy:
matrix:
runs-on:
- Linux
# - windows-latest
compiler:
- { name: "gnu", cpp: 'g++', c: 'gcc' }
# - { name: "clang", cpp: 'clang++', c: 'clang' }
godot-version:
- 4x
configurations:
# - Debug
- Release
architecture:
- x86_x64
# - arm64
runs-on: ${{ matrix.runs-on }}
container:
image: ubuntu:latest
steps:
- name: Install dependencies
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
run: |
apt-get update
apt-get install -y build-essential libssl-dev python3 cmake git git-lfs $CC $CXX
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch all submodules.
submodules: recursive
# - name: Cache
# uses: actions/cache@v4
# with:
# path: |
# build/
# !build/bin
# key: ${{ runner.os }}-${{ matrix.godot-version }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}-${{ matrix.configurations }}-${{ matrix.compiler.name }}-${{ matrix.architecture }}
- name: Build CMake project
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.configurations }} -B build -S . && cmake --build build
- name: Archive build artifacts
run: |
mkdir -p dist/bin
if [[ "${{ matrix.godot-version }}" == "4x" ]]; then
# Write GDExtension config file
cp templates/godot-4x/ dist/
fi
# Copy the built binaries to the dist directory
cp build/bin/ dist/bin/
# Zip file name should be example:
# ubuntu-godot-4x-kafka-v1.0.0-Release-gnu-x86_x64.zip
zip -r ${{ runner.os }}-godot-${{ matrix.godot-version }}-kafka-${{ github.ref }}-${{ matrix.configurations }}-${{ matrix.compiler.name }}-${{ matrix.architecture }}.zip dist
# Upload the asset to the releases page, if the tag is a version tag; otherwise, upload it as an artifact.
- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: ${{ runner.os }}-godot-${{ matrix.godot-version }}-kafka-${{ github.ref }}-${{ matrix.configurations }}-${{ matrix.compiler.name }}-${{ matrix.architecture }}.zip
- name: Upload Artifact Asset
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: build
path: ${{ runner.os }}-godot-${{ matrix.godot-version }}-kafka-${{ github.ref }}-${{ matrix.configurations }}-${{ matrix.compiler.name }}-${{ matrix.architecture }}.zip
if-no-files-found: error
retention-days: 1
overwrite: true