Skip to content

Commit 99eb406

Browse files
committed
Added appveyor github release functionality. Master auto builds are now uploaded to a rolling interim-build pre-release. Release tag builds will upload official release builds from appveyor automatically.
1 parent 897491b commit 99eb406

File tree

12 files changed

+370
-32
lines changed

12 files changed

+370
-32
lines changed

appveyor.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,63 @@ for:
2727
- job_name: Windows 32
2828

2929
build_script:
30-
- cmd: pipelines/win32_build.bat
30+
- cmd: perl pipelines/build.pl win32
3131

3232
-
3333
matrix:
3434
only:
3535
- job_name: Windows 64
3636

3737
build_script:
38-
- cmd: pipelines/win64_build.bat
38+
- cmd: perl pipelines/build.pl win64
3939

4040
-
4141
matrix:
4242
only:
4343
- job_name: Win64 Qt
4444

4545
build_script:
46-
- cmd: pipelines/qwin64_build.bat
46+
- cmd: perl pipelines/build.pl win64-QtSDL
4747

4848
-
4949
matrix:
5050
only:
5151
- job_name: Ubuntu
5252

5353
build_script:
54-
- sh: ./pipelines/linux_build.sh
54+
- sh: perl pipelines/build.pl linux
5555

5656
-
5757
matrix:
5858
only:
5959
- job_name: MacOS
6060

6161
build_script:
62-
- sh: ./pipelines/macOS_build.sh
63-
62+
- sh: perl pipelines/build.pl macOS
63+
64+
deploy:
65+
66+
- provider: GitHub
67+
tag: interim-build
68+
release: interim-build
69+
description: 'Interim Builds - Latest auto builds off master branch - commit: $(APPVEYOR_REPO_COMMIT)\nDate: $(APPVEYOR_REPO_COMMIT_TIMESTAMP)'
70+
auth_token:
71+
secure: 5kNj/zZ1RD5gCBq0Q4my9dBgSTYL7JVvcjv93T9i6FjYA6SAds3/Dmlz8wrRMN8E
72+
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT), $(LINUX_ARTIFACT)
73+
draft: false
74+
prerelease: true
75+
force_update: true
76+
on:
77+
branch: master # release from master branch only
78+
APPVEYOR_REPO_TAG: false # never deploy on tag push
79+
80+
- provider: GitHub
81+
description: 'Release Builds - commit: $(APPVEYOR_REPO_COMMIT)'
82+
auth_token:
83+
secure: 5kNj/zZ1RD5gCBq0Q4my9dBgSTYL7JVvcjv93T9i6FjYA6SAds3/Dmlz8wrRMN8E
84+
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT)
85+
draft: false
86+
prerelease: false
87+
force_update: false
88+
on:
89+
APPVEYOR_REPO_TAG: true # deploy on tag push only

pipelines/build.pl

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
#!/usr/bin/perl
2+
3+
use strict;
4+
use File::Basename;
5+
#use File::Spec;
6+
7+
#
8+
# Global Variables
9+
#
10+
my $platform = "";
11+
my $fceuVersionMajor = 1;
12+
my $fceuVersionMinor = 0;
13+
my $fceuVersionPatch = 0;
14+
15+
foreach my $arg (@ARGV)
16+
{
17+
#print $arg, "\n";
18+
19+
if ($platform eq "")
20+
{
21+
$platform = $arg;
22+
}
23+
}
24+
25+
my $dirname = dirname(__FILE__);
26+
my $projRoot = "$dirname/..";
27+
my $ReleaseBuild=0;
28+
my $ReleaseVersion="";
29+
30+
#print "PATH: $ENV{PATH}\n";
31+
#print "Dir $dirname\n";
32+
#
33+
($fceuVersionMajor, $fceuVersionMinor, $fceuVersionPatch) = getVersion();
34+
35+
($ReleaseBuild, $ReleaseVersion) = isReleaseBuild();
36+
37+
if ($ReleaseBuild)
38+
{
39+
$ENV{FCEU_RELEASE_VERSION} = $ReleaseVersion;
40+
}
41+
42+
if ($platform eq "win32")
43+
{
44+
build_win32();
45+
}
46+
elsif ($platform eq "win64")
47+
{
48+
build_win64();
49+
}
50+
elsif ($platform eq "win64-QtSDL")
51+
{
52+
build_win64_QtSDL();
53+
}
54+
elsif ($platform eq "linux")
55+
{
56+
build_ubuntu_linux();
57+
}
58+
elsif ($platform eq "macOS")
59+
{
60+
build_macOS();
61+
}
62+
#--------------------------------------------------------------------------------------------
63+
# Build win32 version
64+
#--------------------------------------------------------------------------------------------
65+
sub build_win32
66+
{
67+
chdir("$projRoot");
68+
69+
my $ret = system("cmd.exe /c pipelines\\\\win32_build.bat");
70+
71+
if ($ret != 0){ die "Build Errors Detected\n";}
72+
}
73+
#--------------------------------------------------------------------------------------------
74+
# Build win64 version
75+
#--------------------------------------------------------------------------------------------
76+
sub build_win64
77+
{
78+
chdir("$projRoot");
79+
80+
my $ret = system("cmd.exe /c pipelines\\\\win64_build.bat");
81+
82+
if ($ret != 0){ die "Build Errors Detected\n";}
83+
}
84+
#--------------------------------------------------------------------------------------------
85+
# Build win64-Qt/SDL version
86+
#--------------------------------------------------------------------------------------------
87+
sub build_win64_QtSDL
88+
{
89+
chdir("$projRoot");
90+
91+
my $ret = system("cmd.exe /c pipelines\\\\qwin64_build.bat");
92+
93+
if ($ret != 0){ die "Build Errors Detected\n";}
94+
}
95+
#--------------------------------------------------------------------------------------------
96+
# Build Ubuntu Linux version
97+
#--------------------------------------------------------------------------------------------
98+
sub build_ubuntu_linux
99+
{
100+
chdir("$projRoot");
101+
102+
my $ret = system("./pipelines/linux_build.sh");
103+
104+
if ($ret != 0){ die "Build Errors Detected\n";}
105+
}
106+
#--------------------------------------------------------------------------------------------
107+
# Build MacOSX version
108+
#--------------------------------------------------------------------------------------------
109+
sub build_macOS
110+
{
111+
chdir("$projRoot");
112+
113+
my $ret = system("./pipelines/macOS_build.sh");
114+
115+
if ($ret != 0){ die "Build Errors Detected\n";}
116+
}
117+
#--------------------------------------------------------------------------------------------
118+
# Search src/version.h and retrieve version numbers
119+
#--------------------------------------------------------------------------------------------
120+
sub getVersion
121+
{
122+
my $versionHeader = "$projRoot/src/version.h";
123+
my $line;
124+
my $major = 1;
125+
my $minor = 0;
126+
my $patch = 0;
127+
open INFILE, "$versionHeader" or die "Error: Could not open file: $versionHeader\n";
128+
while ($line = <INFILE>)
129+
{
130+
#print $line;
131+
if ($line =~ m/\s*#define\s+FCEU_VERSION_MAJOR\s+(\d+)/)
132+
{
133+
$major = $1;
134+
}
135+
elsif ($line =~ m/\s*#define\s+FCEU_VERSION_MINOR\s+(\d+)/)
136+
{
137+
$minor = $1;
138+
}
139+
elsif ($line =~ m/\s*#define\s+FCEU_VERSION_PATCH\s+(\d+)/)
140+
{
141+
$patch = $1;
142+
}
143+
}
144+
close(INFILE);
145+
146+
return ( $major, $minor, $patch );
147+
}
148+
#--------------------------------------------------------------------------------------------
149+
# Returns whether this is a release build and returns the version if detected
150+
#--------------------------------------------------------------------------------------------
151+
sub isReleaseBuild
152+
{
153+
my $isRelease = 0;
154+
my $tagVersion = "";
155+
156+
if (defined($ENV{APPVEYOR_REPO_TAG_NAME}))
157+
{
158+
if ($ENV{APPVEYOR_REPO_TAG_NAME} =~ m/fceux-(\d+\.\d+\.\d+)/)
159+
{
160+
$tagVersion = $1;
161+
$isRelease = 1;
162+
}
163+
elsif ($ENV{APPVEYOR_REPO_TAG_NAME} =~ m/(\d+\.\d+\.\d+)/)
164+
{
165+
$tagVersion = $1;
166+
$isRelease = 1;
167+
}
168+
}
169+
return ($isRelease, $tagVersion);
170+
}

pipelines/debpkg.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/perl
22

33
use strict;
4+
use File::Basename;
45

5-
my $VERSION="2.6.4";
6+
my $dirname = dirname(__FILE__);
7+
8+
my $VERSION=`perl $dirname/../scripts/fceuVersion.pl`;
69
my $INSTALL_PREFIX="/tmp/fceux";
710
my $CTL_FILENAME="$INSTALL_PREFIX/DEBIAN/control";
811
my $ARCH="amd64";

pipelines/linux_build.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ id
44
pwd
55
uname -a
66
cat /etc/os-release
7+
env
78

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

@@ -20,6 +21,10 @@ echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
2021
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
2122
echo '****************************************'
2223

24+
if [ ! -z $FCEU_RELEASE_VERSION ]; then
25+
APPVEYOR_CMAKE_FLAGS=" -DPUBLIC_RELEASE=1 ";
26+
fi
27+
2328
echo '****************************************'
2429
echo '****************************************'
2530
echo '*** Installing Package Dependencies ***'
@@ -119,6 +124,7 @@ cmake \
119124
-DCMAKE_BUILD_TYPE=Release \
120125
-DCMAKE_INSTALL_PREFIX=/usr \
121126
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
127+
$APPVEYOR_CMAKE_FLAGS \
122128
..
123129
make -j `nproc`
124130
make install DESTDIR=$INSTALL_PREFIX
@@ -191,5 +197,13 @@ echo 'Testing Install of Package'
191197
echo '**************************************************************'
192198
sudo dpkg -i /tmp/fceux-*.deb
193199

194-
echo 'Pushing Debian Package to Build Artifacts'
195-
appveyor PushArtifact /tmp/fceux-*.deb
200+
if [ ! -z $APPVEYOR ]; then
201+
echo 'Pushing Debian Package to Build Artifacts'
202+
if [ -z $FCEU_RELEASE_VERSION ]; then
203+
cp /tmp/fceux-*.deb /tmp/fceux-ubuntu-x64.deb
204+
appveyor PushArtifact /tmp/fceux-ubuntu-x64.deb
205+
appveyor SetVariable -Name LINUX_ARTIFACT -Value fceux-ubuntu-x64.deb
206+
else
207+
appveyor PushArtifact /tmp/fceux-*.deb
208+
fi
209+
fi

pipelines/macOS_build.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ id
55
pwd
66
uname -a
77
sw_vers
8+
env
9+
10+
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
811

912
QT_MAJOR=5;
1013
QT_PKGNAME=qt$QT_MAJOR;
11-
FCEUX_VERSION_MAJOR=2
12-
FCEUX_VERSION_MINOR=6
13-
FCEUX_VERSION_PATCH=4
14+
FCEUX_VERSION_MAJOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -major`;
15+
FCEUX_VERSION_MINOR=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -minor`;
16+
FCEUX_VERSION_PATCH=`perl $SCRIPT_DIR/../scripts/fceuVersion.pl -patch`;
17+
FCEUX_VERSION="$FCEUX_VERSION_MAJOR.$FCEUX_VERSION_MINOR.$FCEUX_VERSION_PATCH";
1418
SDL2_VERSION=2.0.20
1519

16-
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
20+
echo "Building Version: $FCEUX_VERSION";
1721

1822
NPROC=`getconf _NPROCESSORS_ONLN`;
1923
echo "Number of Processors: $NPROC";
@@ -34,6 +38,10 @@ echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
3438
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
3539
echo '****************************************'
3640

41+
if [ ! -z $FCEU_RELEASE_VERSION ]; then
42+
APPVEYOR_CMAKE_FLAGS=" -DPUBLIC_RELEASE=1 ";
43+
fi
44+
3745
echo '****************************************'
3846
echo 'Install Dependency sdl2'
3947
echo '****************************************'
@@ -121,13 +129,23 @@ cmake \
121129
-DCPACK_PACKAGE_VERSION_MINOR=$FCEUX_VERSION_MINOR \
122130
-DCPACK_PACKAGE_VERSION_PATCH=$FCEUX_VERSION_PATCH \
123131
-DQT6=$USE_QT6 \
132+
$APPVEYOR_CMAKE_FLAGS \
124133
.. || exit 1
125134
make -j $NPROC || exit 1
126135
#sudo make install || exit 1 # make install is already run by cpack
127136
sudo cpack -G DragNDrop || exit 1
128137

129-
echo 'Pushing DMG Package to Build Artifacts'
130-
appveyor PushArtifact fceux-*.dmg
138+
if [ ! -z $APPVEYOR ]; then
139+
echo 'Pushing DMG Package to Build Artifacts'
140+
if [ -z $FCEU_RELEASE_VERSION ]; then
141+
cp fceux-*.dmg fceux-Darwin.dmg
142+
appveyor PushArtifact fceux-Darwin.dmg
143+
appveyor SetVariable -Name MACOS_ARTIFACT -Value fceux-Darwin.dmg
144+
else
145+
appveyor PushArtifact fceux-*.dmg
146+
appveyor SetVariable -Name MACOS_ARTIFACT -Value `ls fceux-*.dmg`
147+
fi
148+
fi
131149

132150
# Debug via ssh if necessary
133151
if [ ! -z $APPVEYOR_SSH_BLOCK ]; then

0 commit comments

Comments
 (0)