Skip to content

Commit

Permalink
Added appveyor github release functionality. Master auto builds are n…
Browse files Browse the repository at this point in the history
…ow uploaded to a rolling interim-build pre-release. Release tag builds will upload official release builds from appveyor automatically.
  • Loading branch information
mjbudd77 committed Oct 1, 2022
1 parent 897491b commit 99eb406
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 32 deletions.
38 changes: 32 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,63 @@ for:
- job_name: Windows 32

build_script:
- cmd: pipelines/win32_build.bat
- cmd: perl pipelines/build.pl win32

-
matrix:
only:
- job_name: Windows 64

build_script:
- cmd: pipelines/win64_build.bat
- cmd: perl pipelines/build.pl win64

-
matrix:
only:
- job_name: Win64 Qt

build_script:
- cmd: pipelines/qwin64_build.bat
- cmd: perl pipelines/build.pl win64-QtSDL

-
matrix:
only:
- job_name: Ubuntu

build_script:
- sh: ./pipelines/linux_build.sh
- sh: perl pipelines/build.pl linux

-
matrix:
only:
- job_name: MacOS

build_script:
- sh: ./pipelines/macOS_build.sh

- sh: perl pipelines/build.pl macOS

deploy:

- provider: GitHub
tag: interim-build
release: interim-build
description: 'Interim Builds - Latest auto builds off master branch - commit: $(APPVEYOR_REPO_COMMIT)\nDate: $(APPVEYOR_REPO_COMMIT_TIMESTAMP)'
auth_token:
secure: 5kNj/zZ1RD5gCBq0Q4my9dBgSTYL7JVvcjv93T9i6FjYA6SAds3/Dmlz8wrRMN8E
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT), $(LINUX_ARTIFACT)
draft: false
prerelease: true
force_update: true
on:
branch: master # release from master branch only
APPVEYOR_REPO_TAG: false # never deploy on tag push

- provider: GitHub
description: 'Release Builds - commit: $(APPVEYOR_REPO_COMMIT)'
auth_token:
secure: 5kNj/zZ1RD5gCBq0Q4my9dBgSTYL7JVvcjv93T9i6FjYA6SAds3/Dmlz8wrRMN8E
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT)
draft: false
prerelease: false
force_update: false
on:
APPVEYOR_REPO_TAG: true # deploy on tag push only
170 changes: 170 additions & 0 deletions pipelines/build.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#!/usr/bin/perl

use strict;
use File::Basename;
#use File::Spec;

#
# Global Variables
#
my $platform = "";
my $fceuVersionMajor = 1;
my $fceuVersionMinor = 0;
my $fceuVersionPatch = 0;

foreach my $arg (@ARGV)
{
#print $arg, "\n";

if ($platform eq "")
{
$platform = $arg;
}
}

my $dirname = dirname(__FILE__);
my $projRoot = "$dirname/..";
my $ReleaseBuild=0;
my $ReleaseVersion="";

#print "PATH: $ENV{PATH}\n";
#print "Dir $dirname\n";
#
($fceuVersionMajor, $fceuVersionMinor, $fceuVersionPatch) = getVersion();

($ReleaseBuild, $ReleaseVersion) = isReleaseBuild();

if ($ReleaseBuild)
{
$ENV{FCEU_RELEASE_VERSION} = $ReleaseVersion;
}

if ($platform eq "win32")
{
build_win32();
}
elsif ($platform eq "win64")
{
build_win64();
}
elsif ($platform eq "win64-QtSDL")
{
build_win64_QtSDL();
}
elsif ($platform eq "linux")
{
build_ubuntu_linux();
}
elsif ($platform eq "macOS")
{
build_macOS();
}
#--------------------------------------------------------------------------------------------
# Build win32 version
#--------------------------------------------------------------------------------------------
sub build_win32
{
chdir("$projRoot");

my $ret = system("cmd.exe /c pipelines\\\\win32_build.bat");

if ($ret != 0){ die "Build Errors Detected\n";}
}
#--------------------------------------------------------------------------------------------
# Build win64 version
#--------------------------------------------------------------------------------------------
sub build_win64
{
chdir("$projRoot");

my $ret = system("cmd.exe /c pipelines\\\\win64_build.bat");

if ($ret != 0){ die "Build Errors Detected\n";}
}
#--------------------------------------------------------------------------------------------
# Build win64-Qt/SDL version
#--------------------------------------------------------------------------------------------
sub build_win64_QtSDL
{
chdir("$projRoot");

my $ret = system("cmd.exe /c pipelines\\\\qwin64_build.bat");

if ($ret != 0){ die "Build Errors Detected\n";}
}
#--------------------------------------------------------------------------------------------
# Build Ubuntu Linux version
#--------------------------------------------------------------------------------------------
sub build_ubuntu_linux
{
chdir("$projRoot");

my $ret = system("./pipelines/linux_build.sh");

if ($ret != 0){ die "Build Errors Detected\n";}
}
#--------------------------------------------------------------------------------------------
# Build MacOSX version
#--------------------------------------------------------------------------------------------
sub build_macOS
{
chdir("$projRoot");

my $ret = system("./pipelines/macOS_build.sh");

if ($ret != 0){ die "Build Errors Detected\n";}
}
#--------------------------------------------------------------------------------------------
# Search src/version.h and retrieve version numbers
#--------------------------------------------------------------------------------------------
sub getVersion
{
my $versionHeader = "$projRoot/src/version.h";
my $line;
my $major = 1;
my $minor = 0;
my $patch = 0;
open INFILE, "$versionHeader" or die "Error: Could not open file: $versionHeader\n";
while ($line = <INFILE>)
{
#print $line;
if ($line =~ m/\s*#define\s+FCEU_VERSION_MAJOR\s+(\d+)/)
{
$major = $1;
}
elsif ($line =~ m/\s*#define\s+FCEU_VERSION_MINOR\s+(\d+)/)
{
$minor = $1;
}
elsif ($line =~ m/\s*#define\s+FCEU_VERSION_PATCH\s+(\d+)/)
{
$patch = $1;
}
}
close(INFILE);

return ( $major, $minor, $patch );
}
#--------------------------------------------------------------------------------------------
# Returns whether this is a release build and returns the version if detected
#--------------------------------------------------------------------------------------------
sub isReleaseBuild
{
my $isRelease = 0;
my $tagVersion = "";

if (defined($ENV{APPVEYOR_REPO_TAG_NAME}))
{
if ($ENV{APPVEYOR_REPO_TAG_NAME} =~ m/fceux-(\d+\.\d+\.\d+)/)
{
$tagVersion = $1;
$isRelease = 1;
}
elsif ($ENV{APPVEYOR_REPO_TAG_NAME} =~ m/(\d+\.\d+\.\d+)/)
{
$tagVersion = $1;
$isRelease = 1;
}
}
return ($isRelease, $tagVersion);
}
5 changes: 4 additions & 1 deletion pipelines/debpkg.pl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/perl

use strict;
use File::Basename;

my $VERSION="2.6.4";
my $dirname = dirname(__FILE__);

my $VERSION=`perl $dirname/../scripts/fceuVersion.pl`;
my $INSTALL_PREFIX="/tmp/fceux";
my $CTL_FILENAME="$INSTALL_PREFIX/DEBIAN/control";
my $ARCH="amd64";
Expand Down
18 changes: 16 additions & 2 deletions pipelines/linux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ id
pwd
uname -a
cat /etc/os-release
env

SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );

Expand All @@ -20,6 +21,10 @@ echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
echo '****************************************'

if [ ! -z $FCEU_RELEASE_VERSION ]; then
APPVEYOR_CMAKE_FLAGS=" -DPUBLIC_RELEASE=1 ";
fi

echo '****************************************'
echo '****************************************'
echo '*** Installing Package Dependencies ***'
Expand Down Expand Up @@ -119,6 +124,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
$APPVEYOR_CMAKE_FLAGS \
..
make -j `nproc`
make install DESTDIR=$INSTALL_PREFIX
Expand Down Expand Up @@ -191,5 +197,13 @@ echo 'Testing Install of Package'
echo '**************************************************************'
sudo dpkg -i /tmp/fceux-*.deb

echo 'Pushing Debian Package to Build Artifacts'
appveyor PushArtifact /tmp/fceux-*.deb
if [ ! -z $APPVEYOR ]; then
echo 'Pushing Debian Package to Build Artifacts'
if [ -z $FCEU_RELEASE_VERSION ]; then
cp /tmp/fceux-*.deb /tmp/fceux-ubuntu-x64.deb
appveyor PushArtifact /tmp/fceux-ubuntu-x64.deb
appveyor SetVariable -Name LINUX_ARTIFACT -Value fceux-ubuntu-x64.deb
else
appveyor PushArtifact /tmp/fceux-*.deb
fi
fi
30 changes: 24 additions & 6 deletions pipelines/macOS_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ id
pwd
uname -a
sw_vers
env

SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );

QT_MAJOR=5;
QT_PKGNAME=qt$QT_MAJOR;
FCEUX_VERSION_MAJOR=2
FCEUX_VERSION_MINOR=6
FCEUX_VERSION_PATCH=4
FCEUX_VERSION_MAJOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -major`;
FCEUX_VERSION_MINOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -minor`;
FCEUX_VERSION_PATCH=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -patch`;
FCEUX_VERSION="$FCEUX_VERSION_MAJOR.$FCEUX_VERSION_MINOR.$FCEUX_VERSION_PATCH";
SDL2_VERSION=2.0.20

SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
echo "Building Version: $FCEUX_VERSION";

NPROC=`getconf _NPROCESSORS_ONLN`;
echo "Number of Processors: $NPROC";
Expand All @@ -34,6 +38,10 @@ echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
echo '****************************************'

if [ ! -z $FCEU_RELEASE_VERSION ]; then
APPVEYOR_CMAKE_FLAGS=" -DPUBLIC_RELEASE=1 ";
fi

echo '****************************************'
echo 'Install Dependency sdl2'
echo '****************************************'
Expand Down Expand Up @@ -121,13 +129,23 @@ cmake \
-DCPACK_PACKAGE_VERSION_MINOR=$FCEUX_VERSION_MINOR \
-DCPACK_PACKAGE_VERSION_PATCH=$FCEUX_VERSION_PATCH \
-DQT6=$USE_QT6 \
$APPVEYOR_CMAKE_FLAGS \
.. || exit 1
make -j $NPROC || exit 1
#sudo make install || exit 1 # make install is already run by cpack
sudo cpack -G DragNDrop || exit 1

echo 'Pushing DMG Package to Build Artifacts'
appveyor PushArtifact fceux-*.dmg
if [ ! -z $APPVEYOR ]; then
echo 'Pushing DMG Package to Build Artifacts'
if [ -z $FCEU_RELEASE_VERSION ]; then
cp fceux-*.dmg fceux-Darwin.dmg
appveyor PushArtifact fceux-Darwin.dmg
appveyor SetVariable -Name MACOS_ARTIFACT -Value fceux-Darwin.dmg
else
appveyor PushArtifact fceux-*.dmg
appveyor SetVariable -Name MACOS_ARTIFACT -Value `ls fceux-*.dmg`
fi
fi

# Debug via ssh if necessary
if [ ! -z $APPVEYOR_SSH_BLOCK ]; then
Expand Down
Loading

0 comments on commit 99eb406

Please sign in to comment.