Skip to content

CMakeLists.txt : add log.c to the build #109

CMakeLists.txt : add log.c to the build

CMakeLists.txt : add log.c to the build #109

Workflow file for this run

name: Build and upload Latest Release
on: [push, pull_request]
env:
GIT_PAGER:
BUILD_TYPE: Release
jobs:
#### Prepare build definitions
get_release_definitions:
name: Get Release definitions
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-tags: 'true'
fetch-depth: '1000'
submodules: 'true'
- name: Define Release Strategy
id: DefineReleaseStrategy
run: |
pip install python-kacl
# GIT_REV_NAME: as seen in https://stackoverflow.com/a/11489642
# Creates a Stable Release only if tags are pushed at the same time as the relevant commit:
# git push origin <my branch> --tags
# Tag can be lightweight or annotated.
GIT_REV_NAME=$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true | sed -n 's/^\([^^~]\{1,\}\)\(\^0\)\{0,1\}$/\1/p')
echo "############### GIT_REV_NAME = ${GIT_REV_NAME}"
# Stable Release: regex checks exact match to '^v<maj>.<min>.<patch>$'
if [[ "xxx${GIT_REV_NAME}" =~ ^xxxv[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "############### Matched an exact Stable Release Tag"
RELEASE_TAG="${GIT_REV_NAME}"
RELEASE_DESCR="Stable Release"
RELEASE_PRERELEASE="false"
kacl-cli get ${GIT_REV_NAME:1} > RELEASE_LOG.md \
|| echo "Release description unavailable" > RELEASE_LOG.md
elif [[ "xxx${GIT_REV_NAME}" =~ ^xxxv[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "############### Matched an RC Release Tag"
RELEASE_TAG="${GIT_REV_NAME}"
RELEASE_DESCR="Release Candidate"
RELEASE_PRERELEASE="true"
kacl-cli get ${GIT_REV_NAME:1} > RELEASE_LOG.md \
|| echo "Release description unavailable" > RELEASE_LOG.md
else
echo "############### Unmatched release Tags, going to 'latest'"
kacl-cli get unreleased > RELEASE_LOG.md \
|| echo "Release description unavailable" > RELEASE_LOG.md
RELEASE_TAG="latest"
RELEASE_DESCR="Development Release"
RELEASE_PRERELEASE="true"
fi
echo "############### RELEASE_TAG = ${RELEASE_TAG}"
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_OUTPUT
echo "############### RELEASE_DESCR = ${RELEASE_DESCR}"
echo "RELEASE_DESCR=${RELEASE_DESCR}" >> $GITHUB_OUTPUT
echo "############### RELEASE_PRERELEASE = ${RELEASE_PRERELEASE}"
echo "RELEASE_PRERELEASE=${RELEASE_PRERELEASE}" >> $GITHUB_OUTPUT
echo "############### showing all known tags"
git tag
echo "############### Building version '${RELEASE_TAG}'"
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
retention-days: 1
name: definitions
path: RELEASE_LOG.md
outputs:
RELEASE_TAG: ${{ steps.DefineReleaseStrategy.outputs.RELEASE_TAG }}
RELEASE_DESCR: ${{ steps.DefineReleaseStrategy.outputs.RELEASE_DESCR }}
RELEASE_PRERELEASE: ${{ steps.DefineReleaseStrategy.outputs.RELEASE_PRERELEASE }}
#### Linux x86_64
build_x86_64:
if: ${{ github.event.inputs.job_enabled_x86_64 != 'false' }}
name: Build Linux x86_64 on Ubuntu-22.04
runs-on: ubuntu-22.04
needs:
- get_release_definitions
env:
RELEASE_TAG: ${{needs.get_release_definitions.outputs.RELEASE_TAG}}
continue-on-error: false
steps:
- uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-tags: 'true'
fetch-depth: '1000'
submodules: 'true'
- name: Install Dependencies
if: ${{ github.event.inputs.build_enabled_x86_64 != 'false' }}
run: |
sudo apt update
sudo apt install -y git cmake libsdl2-dev
- name: Configure CMake
if: ${{ github.event.inputs.build_enabled_x86_64 != 'false' }}
run: |
echo "############### configuring cmake"
cmake -B build/ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSUPPORT_SHADERS=True
- name: Build w/ CMake
if: ${{ github.event.inputs.build_enabled_x86_64 != 'false' }}
run: |
echo "############### building with cmake"
cmake --version
cmake --build build/ --config ${{env.BUILD_TYPE}} --parallel 4
- name: Create Artifact
run: |
mkdir sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/
cp -v build/sqlay3 sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/sqlay3
cp -v build/sq68ux sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/sq68ux
zip -r sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}.zip \
sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}/
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
retention-days: 1
name: sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}
path: sq68lay-linux-x86_64-Ubuntu-22.04-${{ env.RELEASE_TAG }}.zip
#### Linux ARM
build_arm:
if: ${{ github.event.inputs.job_enabled_arm != 'false' }}
name: Build Linux arm on ${{ matrix.distro }} ${{ matrix.arch }}
runs-on: ubuntu-22.04
needs:
- get_release_definitions
env:
RELEASE_TAG: ${{needs.get_release_definitions.outputs.RELEASE_TAG}}
continue-on-error: false
strategy:
matrix:
include:
- arch: aarch64
arch_source: arm64
distro: ubuntu22.04
distroDescr: ubuntu22.04-jammy
- arch: armv7
arch_source: armhf
distro: ubuntu22.04
distroDescr: ubuntu22.04-jammy
steps:
- uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-tags: 'true'
fetch-depth: '1000'
submodules: 'true'
- uses: uraimo/run-on-arch-action@v2.7.1
if: ${{ github.event.inputs.build_enabled_arm != 'false' }}
name: Build w/ CMake
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
githubToken: ${{ github.token }}
shell: /bin/sh
install: |
case "${{ matrix.distro }}" in
ubuntu*|jessie|stretch|buster|bullseye)
apt-get update -q -y
apt-get install -q -y git libsdl2-dev cmake gcc g++ make
;;
esac
run: |
echo "############### configuring cmake"
cmake -B build/ \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_TOOLCHAIN_FILE=Toolchain-${{ matrix.arch_source }}.cmake
echo "############### building with cmake"
cmake --build build/ --config ${{env.BUILD_TYPE}} --parallel 4
- name: Create Artifact
run: |
mkdir sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/
cp -v build/sqlay3 sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/sqlay3
cp -v build/sq68ux sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/sq68ux
zip -r sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}.zip \
sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}/
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
retention-days: 1
name: sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}
path: sq68lay-linux-${{ matrix.arch }}-${{ matrix.distroDescr }}-${{ env.RELEASE_TAG }}*.zip
#### MacOS
build_macos:
if: ${{ github.event.inputs.job_enabled_macos != 'false' }}
name: Build MacOS x86_64 on MacOS-12
runs-on: macos-12
needs:
- get_release_definitions
env:
RELEASE_TAG: ${{needs.get_release_definitions.outputs.RELEASE_TAG}}
continue-on-error: false
steps:
- uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-tags: 'true'
fetch-depth: '1000'
submodules: 'true'
- name: get Arch and O.S. info
run: |
sw_vers
sysctl machdep.cpu.brand_string
- name: Install Dependencies
run: |
brew install sdl2
- name: Configure CMake
if: ${{ github.event.inputs.build_enabled_macos != 'false' }}
run: |
cmake -B build/ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSUPPORT_SHADERS=True
- name: Build w/ CMake
if: ${{ github.event.inputs.build_enabled_macos != 'false' }}
run: |
cmake --build build/ --config ${{env.BUILD_TYPE}}
- name: Create Artifact
run: |
mkdir sq68lay-macos-intel-${{ env.RELEASE_TAG }}/
cp -v build/sqlay3 sq68lay-macos-intel-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-macos-intel-${{ env.RELEASE_TAG }}/sqlay3
cp -v build/sq68ux sq68lay-macos-intel-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-macos-intel-${{ env.RELEASE_TAG }}/sq68ux
zip -r sq68lay-macos-intel-${{ env.RELEASE_TAG }}.zip \
sq68lay-macos-intel-${{ env.RELEASE_TAG }}/
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
retention-days: 1
name: sq68lay-macos-intel-${{ env.RELEASE_TAG }}
path: sq68lay-macos-intel-${{ env.RELEASE_TAG }}.zip
#### WINDOWS
build_windows:
if: ${{ github.event.inputs.job_enabled_windows != 'false' }}
name: Build Windows on ${{ matrix.env }} ${{ matrix.sys }}
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
needs:
- get_release_definitions
env:
RELEASE_TAG: ${{needs.get_release_definitions.outputs.RELEASE_TAG}}
continue-on-error: false
strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }
steps:
- uses: actions/checkout@v4
with:
filter: "blob:none"
fetch-tags: 'true'
fetch-depth: '1000'
submodules: 'true'
- uses: msys2/setup-msys2@v2
if: ${{ !github.event.act }}
with:
msystem: ${{matrix.sys}}
update: true
install: >-
git
make
zip
mingw-w64-${{matrix.env}}-cc
mingw-w64-${{matrix.env}}-SDL2
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-make
- name: Configure CMake
if: ${{ github.event.inputs.build_enabled_windows != 'false' }}
run: |
cmake -B build/ -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build w/ CMake
if: ${{ github.event.inputs.build_enabled_windows != 'false' }}
run: |
cmake --build build/ --config ${{env.BUILD_TYPE}}
- name: Create Package
run: |
mkdir sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}
cp -v build/sqlay3.exe sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}/sqlay3.exe
cp -v build/sq68ux.exe sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}/ ||
touch sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}/sq68ux.exe
zip -r sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}.zip \
sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}/
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}
path: sq68lay-windows-${{ matrix.sys }}-${{ env.RELEASE_TAG }}*.zip
#### Upload artifacts to Releases
upload_artifacts:
name: Upload Artifacts to Releases
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
needs:
# - prepare_artifacts_cache
- get_release_definitions
- build_x86_64
- build_arm
- build_macos
- build_windows
env:
RELEASE_TAG: ${{needs.get_release_definitions.outputs.RELEASE_TAG}}
RELEASE_DESCR: ${{needs.get_release_definitions.outputs.RELEASE_DESCR}}
RELEASE_PRERELEASE: ${{needs.get_release_definitions.outputs.RELEASE_PRERELEASE}}
steps:
- name: Restore Artifacts Cache
uses: actions/download-artifact@v3
with:
path: artifacts
- name: list Artifacts
run: |
ls -la artifacts/*/*
- name: ${{ env.RELEASE_TAG }} ${{ env.RELEASE_DESCR }}
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ env.RELEASE_PRERELEASE}}
tag_name: ${{ env.RELEASE_TAG }}
body_path: artifacts/definitions/RELEASE_LOG.md
files: artifacts/*/*.zip