Skip to content

Commit 1a1c3df

Browse files
committed
Add support for building test builds on the CI servers
Any branch starting with "test/" will cause test builds to be compiled and uploaded to fs2downloads. This will only work for the main repository since the secure variables for the FTP credentials only work for that repository.
1 parent 0dc0d67 commit 1a1c3df

File tree

7 files changed

+71
-13
lines changed

7 files changed

+71
-13
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,18 @@ deploy:
4848
tags: true
4949

5050
- provider: script
51-
script: ci/travis/nightly_deploy.sh
51+
script: ci/travis/ftp_deploy.sh
5252
on:
5353
condition: '"$NIGHTLY_BUILD" == true'
5454
tags: true
5555

56+
- provider: script
57+
skip_cleanup: true
58+
script: bash ci/travis/ftp_deploy.sh
59+
on:
60+
condition: $TEST_BUILD = true
61+
all_branches: true
62+
5663
matrix:
5764
include:
5865
# note that gcc Debug MUST be 1st for Coverity

appveyor.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,15 @@ deploy:
4747
beta: true
4848
on:
4949
NightlyBuild: true # deploy on nightly push only
50+
51+
- provider: FTP
52+
protocol: ftp
53+
host: swc.fs2downloads.com
54+
username:
55+
secure: EXg2ADoKzMduZF90ip2Q0g==
56+
password:
57+
secure: x0LL0uY9yBAQ7JTARhQ6AA==
58+
folder: swc.fs2downloads.com/builds/test/$(VersionName)
59+
beta: true
60+
on:
61+
TestBuild: true # deploy on test build push only

ci/appveyor/build.ps1

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ $BuildConfigurations = $null
5959
# Default values
6060
$ReleaseBuild = $false
6161
$NightlyBuild = $false
62-
$DeployBuild = $false
62+
$TestBuild = $false
6363

6464
# Set to true to test either the release or the nightly part of this script
6565
$ReleaseTest = $false
6666
$NightlyTest = $false
67+
$TestBuildTest = $false
6768

6869
if ($ReleaseTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)"))) {
6970
# Tag matches
@@ -80,19 +81,31 @@ if ($NightlyTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And (
8081
$BuildConfigurations = $NightlyConfigurations
8182
}
8283

84+
if ($TestBuildTest -Or ([System.Convert]::ToInt32($env:APPVEYOR_PULL_REQUEST_NUMBER) -le 0 -And ("$env:APPVEYOR_REPO_BRANCH" -match "^test\/(.*)"))) {
85+
# Tag matches
86+
$TestBuild = $true
87+
$PackageName = "test_$($matches[1])"
88+
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
89+
$BuildConfigurations = $NightlyConfigurations
90+
91+
# Override the revision string so that the builds are named correctly
92+
[System.IO.File]::WriteAllLines("$env:APPVEYOR_BUILD_FOLDER/version_override.cmake", "set(FSO_VERSION_REVISION_STR $env:VersionName)")
93+
}
94+
8395
# Multiply by 2 so that we can add 0 or 1 for debug or release Configs
8496
$buildID = [convert]::ToInt32($env:BuildID) * 2
8597
if ($Env:Configuration -eq "Release") {
8698
$buildID = $buildID + 1
8799
}
88-
Write-Host "$buildID"
89100

90-
if ($ReleaseBuild -Or $NightlyBuild) {
101+
$DeployBuild = $false
102+
if ($ReleaseBuild -Or $NightlyBuild -Or $TestBuild) {
91103
$DeployBuild = $true
92104
}
93105

94106
Set-AppveyorBuildVariable 'ReleaseBuild' "$ReleaseBuild"
95107
Set-AppveyorBuildVariable 'NightlyBuild' "$NightlyBuild"
108+
Set-AppveyorBuildVariable 'TestBuild' "$TestBuild"
96109

97110
New-Item build -type directory
98111
Set-Location -Path build

ci/appveyor/test.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild)) {
2+
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild) -Or [System.Convert]::ToBoolean($env:TestBuild)) {
33
# Skip tests for deployment
44
exit 0
55
} else {

ci/travis/check_release.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22

33
RELEASE_BUILD=false
44
NIGHTLY_BUILD=false
5+
TEST_BUILD=false
6+
57
BUILD_DEPLOYMENT=false
68
BUILD_CONFIGS="Release FastDebug"
79
VERSION_NAME=""
810
PACKAGE_NAME=""
911

1012
RELEASE_PATTERN="^release_(.*)$"
1113
NIGHTLY_PATTERN="^nightly_(.*)$"
14+
TEST_BUILD_PATTERN="^test\/(.*)$"
1215

1316
# These are for testing
1417
NIGHTLY_TEST=false
1518
RELEASE_TEST=false
19+
TEST_BUILD_TEST=false
1620

1721
if [ "$RELEASE_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $RELEASE_PATTERN ]]; then
1822
echo "This is a release tag!";
@@ -25,8 +29,22 @@ if [ "$NIGHTLY_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $NIGHTLY_PATTERN ]]; then
2529
VERSION_NAME="${BASH_REMATCH[1]}";
2630
PACKAGE_NAME="nightly_${BASH_REMATCH[1]}";
2731
fi
32+
if [ "$TEST_BUILD_TEST" = true ] || [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" =~ $TEST_BUILD_PATTERN ]]; then
33+
echo "This is a test build branch!";
34+
TEST_BUILD=true;
35+
if [ "$TEST_BUILD_TEST" = true ]; then
36+
VERSION_NAME="test";
37+
PACKAGE_NAME="test_test";
38+
else
39+
VERSION_NAME="${BASH_REMATCH[1]}";
40+
PACKAGE_NAME="test_${BASH_REMATCH[1]}";
41+
fi
42+
43+
# Override the revision string so that the builds are named correctly
44+
echo "set(FSO_VERSION_REVISION_STR $VERSION_NAME)" > "$TRAVIS_BUILD_DIR/version_override.cmake"
45+
fi
2846

29-
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ]); then
47+
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ] || [ "$TEST_BUILD" = true ]); then
3048
BUILD_DEPLOYMENT=true;
3149
fi
3250

@@ -44,6 +62,7 @@ fi
4462

4563
export RELEASE_BUILD
4664
export NIGHTLY_BUILD
65+
export TEST_BUILD
4766
export BUILD_DEPLOYMENT
4867
export BUILD_CONFIGS
4968
export VERSION_NAME
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ fi
4141
cd /tmp/builds
4242

4343
for file in *; do
44-
# Upload to indiegames
45-
curl -k "sftp://scp.indiegames.us/~/public_html/builds/nightly/$VERSION_NAME/" --user "$INDIEGAMES_USER:$INDIEGAMES_PASSWORD" -T "$file" --ftp-create-dirs
46-
47-
# Upload to fs2downloads
48-
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/nightly/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
44+
if [ "$TEST_BUILD" = true ]; then
45+
# Upload to fs2downloads
46+
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/test/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
47+
else
48+
# Upload to indiegames
49+
curl -k "sftp://scp.indiegames.us/~/public_html/builds/nightly/$VERSION_NAME/" --user "$INDIEGAMES_USER:$INDIEGAMES_PASSWORD" -T "$file" --ftp-create-dirs
50+
51+
# Upload to fs2downloads
52+
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/nightly/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
53+
fi
4954
done

ci/travis/release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ set -ex
44
mkdir -p /tmp/builds
55

66
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
7-
PARENT_DIR="$(basename $PWD)"
8-
(cd .. && tar cvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
7+
if [ "$RELEASE_BUILD" = true ]; then
8+
PARENT_DIR="$(basename $PWD)"
9+
(cd .. && tar cvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
10+
fi
911

1012
cd build
1113
for config in $BUILD_CONFIGS

0 commit comments

Comments
 (0)