Start producing nightly builds of ecode for Linux and Windows, macOS pending (issue SpartanJ/ecode#228)

This commit is contained in:
Martín Lucas Golini
2024-09-29 14:23:54 -03:00
parent cf3ca0d82c
commit e789c15022
6 changed files with 192 additions and 5 deletions

133
.github/workflows/ecode-nightly.yml vendored Normal file
View File

@@ -0,0 +1,133 @@
name: Build Nightly
on:
push:
branches:
- 'develop'
workflow_dispatch:
permissions: write-all
jobs:
release:
name: Create Nightly Release
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.tag.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: 'recursive' }
- name: Set Tag
id: tag
run: |
echo "version=nightly" >> "$GITHUB_OUTPUT"
- name: Update Tag
uses: richardsimko/update-tag@v1
with:
tag_name: ${{ steps.tag.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.version }}
name: ecode ${{ steps.tag.outputs.version }}
draft: false
prerelease: true
generate_release_notes: true
body: >
Builds that include most recent changes as they happen. For stable releases check the whole list of [releases](https://github.com/SpartanJ/ecode/releases).
build_linux:
name: Linux
needs: release
strategy:
matrix:
config:
- compiler: default
arch: x86_64
container: ubuntu-22.04
- compiler: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
arch: aarch64
container: ubuntu-22.04
runs-on: ${{ matrix.config.container }}
env:
CC: gcc
CXX: g++
steps:
- name: Checkout Code
uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: 'recursive' }
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
if [[ $(uname -m) != ${{ matrix.config.arch }} ]]; then
echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
echo "CXX=aarch64-linux-gnu-g++" >> "$GITHUB_ENV"
echo "RARCH=arm64" >> "$GITHUB_ENV"
else
echo "RARCH=$(uname -m)" >> "$GITHUB_ENV"
fi
- name: Update Packages
run: |
if [[ $(uname -m) = ${{ matrix.config.arch }} ]]; then
sudo add-apt-repository -y universe
sudo add-apt-repository -y multiverse
sudo apt-get update
else
url="http://ports.ubuntu.com/ubuntu-ports"
repos="main restricted universe multiverse"
echo "deb [arch=arm64] $url jammy $repos" > arm64.list
echo "deb [arch=arm64] $url jammy-updates $repos" >> arm64.list
echo "deb [arch=arm64] $url jammy-security $repos" >> arm64.list
echo "deb [arch=arm64] $url jammy-backports $repos" >> arm64.list
sudo mv arm64.list /etc/apt/sources.list.d/
sudo apt-get update
sudo dpkg --add-architecture arm64
fi
- name: Install dependencies
run: |
sudo apt-get install -y ccache premake4 libfuse2 fuse
if [[ $(uname -m) = "x86_64" ]]; then
sudo apt-get install -y mingw-w64
wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
tar xvzf premake-5.0.0-beta2-linux.tar.gz
fi
if [[ $(uname -m) = ${{ matrix.config.arch }} ]]; then
sudo apt install -y gcc-12 g++-12 libsdl2-2.0-0 libsdl2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
else
sudo apt-get install -y libsdl2-dev:arm64 libsdl2-2.0-0:arm64
fi
- name: Install Cross Compiler
if: ${{ matrix.config.compiler != 'default' }}
run: sudo apt-get install -y ${{ matrix.config.compiler }}
- name: Build ecode
run: |
bash projects/linux/ecode/build.app.sh --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }}
if [[ $(uname -m) = "x86_64" ]]; then
bash projects/mingw32/ecode/build.app.sh --version ${{ env.INSTALL_REF }}
fi
- name: Upload Files
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.version }}
draft: false
prerelease: true
files: |
projects/linux/ecode/ecode-linux-${{ env.INSTALL_REF }}-${{ env.RARCH }}.AppImage
projects/linux/ecode/ecode-linux-${{ env.INSTALL_REF }}-${{ env.RARCH }}.tar.gz
projects/mingw32/ecode/ecode-windows-${{ env.INSTALL_REF }}-${{ env.RARCH }}.zip

View File

@@ -5,6 +5,7 @@ cd "$DIRPATH" || exit
cd ../../../ || exit
DEBUG_SYMBOLS=
VERSION=
ARCH=$(arch)
for i in "$@"; do
case $i in
--with-debug-symbols)
@@ -14,6 +15,12 @@ for i in "$@"; do
--version)
if [[ -n $2 ]]; then VERSION="$2"; fi
shift
shift
;;
--arch)
if [[ -n $2 ]]; then ARCH="$2"; fi
shift
shift
;;
-*|--*)
echo "Unknown option $i"
@@ -24,10 +31,14 @@ for i in "$@"; do
esac
done
if [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
if command -v premake4 &> /dev/null
then
premake4 $DEBUG_SYMBOLS gmake || exit
elif command -v premake4 &> /dev/null
elif command -v premake5 &> /dev/null
then
premake5 $DEBUG_SYMBOLS gmake2 || exit
else
@@ -96,7 +107,7 @@ then
chmod +x "$APPIMAGETOOL"
fi
ECODE_NAME=ecode-linux-"$ECODE_VERSION"-"$(arch)"
ECODE_NAME=ecode-linux-"$ECODE_VERSION"-"$ARCH"
if [ -n "$DEBUG_SYMBOLS" ];
then
@@ -109,13 +120,14 @@ then
objcopy -S ecode.app/libs/libeepp.so ecode.app/libs/libeepp.so
fi
echo "Generating $ECODE_NAME.AppImage"
$APPIMAGETOOL ecode.app "$ECODE_NAME".AppImage
rm ecode.app/.DirIcon
mv ecode.app/AppRun ecode.app/ecode
mv ecode.app ecode
echo "Generating $ECODE_NAME.tar.gz"
tar -czf "$ECODE_NAME".tar.gz ecode
mv ecode ecode.app

View File

@@ -12,6 +12,7 @@ for i in "$@"; do
--version)
if [[ -n $2 ]]; then VERSION="$2"; fi
shift
shift
;;
arch=*)
ARCH_CONFIG="${i#*=}"
@@ -83,4 +84,5 @@ fi
ECODE_ZIP_NAME=ecode-windows-"$ECODE_VERSION"-$ARCH.zip
echo "Generating $ECODE_ZIP_NAME"
zip -r "$ECODE_ZIP_NAME" ecode/

View File

@@ -17,7 +17,23 @@ if [[ "$CONFIG" == *"x86_64"* ]]; then
ARCH=64
fi
premake5 --file=../../premake5.lua --os=windows --cc=mingw --windows-mingw-build gmake2
if command -v premake5 &> /dev/null
then
premake5 --file=../../premake5.lua --os=windows --cc=mingw --windows-mingw-build gmake2
elif [ -f ../../premake5 ]; then
../../premake5 --file=../../premake5.lua --os=windows --cc=mingw --windows-mingw-build gmake2
else
echo "Neither premake5 nor premake4 is available. Please install one."
exit 1
fi
cd ../../make/windows/ || exit
mingw"$ARCH"-make "$@"
if command -v mingw"$ARCH"-make &> /dev/null
then
mingw"$ARCH"-make "$@"
else
export CC=x86_64-w64-mingw32-gcc-posix
export CXX=x86_64-w64-mingw32-g++-posix
make "$@"
fi

View File

@@ -212,6 +212,18 @@ Process::createWithPseudoTerminal( const std::string& program, const std::vector
#include <iomanip>
#include <sstream>
#define NTDDI_VERSION NTDDI_WIN10_RS5
#ifdef _WIN32_WINDOWS
#undef _WIN32_WINDOWS
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#ifdef WINVER
#undef WINVER
#endif
#define _WIN32_WINDOWS 0x0602
#define _WIN32_WINNT 0x0602
#define WINVER 0x0602
#include <windows.h>
using namespace EE;

View File

@@ -26,6 +26,18 @@
using namespace EE::System;
#define NTDDI_VERSION NTDDI_WIN10_RS5
#ifdef _WIN32_WINDOWS
#undef _WIN32_WINDOWS
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#ifdef WINVER
#undef WINVER
#endif
#define _WIN32_WINDOWS 0x0602
#define _WIN32_WINNT 0x0602
#define WINVER 0x0602
#include <comdef.h>
#include <iostream>
#include <string>