Travis/AppVeyor: Deploy based upon tags

This commit is contained in:
j-selby 2017-08-03 15:51:48 +10:00
parent 035716d57b
commit 8bda0ca68d
3 changed files with 107 additions and 117 deletions

View File

@ -1,134 +1,132 @@
if [ "$TRAVIS_EVENT_TYPE" = "push" ]&&[ "$TRAVIS_BRANCH" = "master" ]; then GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`"
GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" GITREV="`git show -s --format='%h'`"
GITREV="`git show -s --format='%h'`" mkdir -p artifacts
mkdir -p artifacts
if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
REV_NAME="citra-linux-${GITDATE}-${GITREV}" REV_NAME="citra-linux-${GITDATE}-${GITREV}"
ARCHIVE_NAME="${REV_NAME}.tar.xz" ARCHIVE_NAME="${REV_NAME}.tar.xz"
COMPRESSION_FLAGS="-cJvf" COMPRESSION_FLAGS="-cJvf"
mkdir "$REV_NAME" mkdir "$REV_NAME"
cp build/src/citra/citra "$REV_NAME" cp build/src/citra/citra "$REV_NAME"
cp build/src/citra_qt/citra-qt "$REV_NAME" cp build/src/citra_qt/citra-qt "$REV_NAME"
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
REV_NAME="citra-osx-${GITDATE}-${GITREV}" REV_NAME="citra-osx-${GITDATE}-${GITREV}"
ARCHIVE_NAME="${REV_NAME}.tar.gz" ARCHIVE_NAME="${REV_NAME}.tar.gz"
COMPRESSION_FLAGS="-czvf" COMPRESSION_FLAGS="-czvf"
mkdir "$REV_NAME" mkdir "$REV_NAME"
cp build/src/citra/Release/citra "$REV_NAME" cp build/src/citra/Release/citra "$REV_NAME"
cp -r build/src/citra_qt/Release/citra-qt.app "$REV_NAME" cp -r build/src/citra_qt/Release/citra-qt.app "$REV_NAME"
# move qt libs into app bundle for deployment # move qt libs into app bundle for deployment
$(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app"
# move SDL2 libs into folder for deployment # move SDL2 libs into folder for deployment
dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/"
# Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation). # Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation).
# To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks # To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks
# (in the Contents/Frameworks folder). # (in the Contents/Frameworks folder).
# The "install_name_tool" is used to do so. # The "install_name_tool" is used to do so.
# Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e: # Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e:
# ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1 # ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1
# grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1 # grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1
brew install coreutils brew install coreutils
REV_NAME_ALT=$REV_NAME/ REV_NAME_ALT=$REV_NAME/
# grealpath is located in coreutils, there is no "realpath" for OS X :( # grealpath is located in coreutils, there is no "realpath" for OS X :(
QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)") QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)")
BREW_PATH=$(brew --prefix) BREW_PATH=$(brew --prefix)
QT_VERSION_NUM=5 QT_VERSION_NUM=5
$BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \ $BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \
-executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt" -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt"
# These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them. # These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them.
declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport") declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport")
for macos_lib in "${macos_libs[@]}" for macos_lib in "${macos_libs[@]}"
do
SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib
# Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/)
cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
# Replace references within the embedded Framework files with "internal" versions.
for macos_lib2 in "${macos_libs[@]}"
do do
SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated.
# Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/) # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files.
cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't.
RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2
# Replace references within the embedded Framework files with "internal" versions. install_name_tool -change \
for macos_lib2 in "${macos_libs[@]}" $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \
do @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
# Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated. "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
# /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files. install_name_tool -change \
# So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't. "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
install_name_tool -change \ "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
$QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \
@executable_path/../Frameworks/$RM_FRAMEWORK_PART \
"${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
install_name_tool -change \
"$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
@executable_path/../Frameworks/$RM_FRAMEWORK_PART \
"${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART"
done
done done
done
# Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"` # Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"`
# Which manifests itself as: # Which manifests itself as:
# "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY" # "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY"
# There may be more dylibs needed to be fixed... # There may be more dylibs needed to be fixed...
declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib") declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib")
for macos_lib in "${macos_plugins[@]}" for macos_lib in "${macos_plugins[@]}"
do
install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
for macos_lib2 in "${macos_libs[@]}"
do do
install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2
for macos_lib2 in "${macos_libs[@]}" install_name_tool -change \
do $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \
RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
install_name_tool -change \ "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
$QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ install_name_tool -change \
@executable_path/../Frameworks/$RM_FRAMEWORK_PART \ "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
"${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" @executable_path/../Frameworks/$RM_FRAMEWORK_PART \
install_name_tool -change \ "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
"$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \
@executable_path/../Frameworks/$RM_FRAMEWORK_PART \
"${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib"
done
done done
done
for macos_lib in "${macos_libs[@]}" for macos_lib in "${macos_libs[@]}"
do do
# Debugging info for Travis-CI # Debugging info for Travis-CI
otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib"
done done
# Make the citra-qt.app application launch a debugging terminal. # Make the citra-qt.app application launch a debugging terminal.
# Store away the actual binary # Store away the actual binary
mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin
cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL
#!/usr/bin/env bash #!/usr/bin/env bash
cd "\`dirname "\$0"\`" cd "\`dirname "\$0"\`"
chmod +x citra-qt-bin chmod +x citra-qt-bin
open citra-qt-bin --args "\$@" open citra-qt-bin --args "\$@"
EOL EOL
# Content that will serve as the launching script for citra (within the .app folder) # Content that will serve as the launching script for citra (within the .app folder)
# Make the launching script executable # Make the launching script executable
chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt
fi
# Copy documentation
cp license.txt "$REV_NAME"
cp README.md "$REV_NAME"
tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME"
mv "$REV_NAME" nightly
7z a "$REV_NAME.7z" nightly
# move the compiled archive into the artifacts directory to be uploaded by travis releases
mv "$ARCHIVE_NAME" artifacts/
mv "$REV_NAME.7z" artifacts/
fi fi
# Copy documentation
cp license.txt "$REV_NAME"
cp README.md "$REV_NAME"
tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME"
mv "$REV_NAME" nightly
7z a "$REV_NAME.7z" nightly
# move the compiled archive into the artifacts directory to be uploaded by travis releases
mv "$ARCHIVE_NAME" artifacts/
mv "$REV_NAME.7z" artifacts/

View File

@ -37,4 +37,4 @@ deploy:
file: "artifacts/*" file: "artifacts/*"
skip_cleanup: true skip_cleanup: true
on: on:
repo: citra-emu/citra-nightly tags: true

View File

@ -1,9 +1,6 @@
# shallow clone # shallow clone
clone_depth: 10 clone_depth: 10
# don't build on tag
skip_tags: true
cache: cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml - C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml - C:\ProgramData\chocolatey\lib -> appveyor.yml
@ -72,16 +69,11 @@ artifacts:
deploy: deploy:
provider: GitHub provider: GitHub
release: nightly-$(appveyor_build_number) release: $(appveyor_repo_tag_name)
description: |
Citra nightly releases. Please choose the correct download for your operating system from the list below.
Short Commit Hash $(GITREV)
auth_token: auth_token:
secure: "dbpsMC/MgPKWFNJCXpQl4cR8FYhepkPLjgNp/pRMktZ8oLKTqPYErfreaIxb/4P1" secure: "dbpsMC/MgPKWFNJCXpQl4cR8FYhepkPLjgNp/pRMktZ8oLKTqPYErfreaIxb/4P1"
artifact: msvcupdate,msvcbuild artifact: msvcupdate,msvcbuild
draft: false draft: false
prerelease: false prerelease: false
on: on:
branch: master appveyor_repo_tag: true
appveyor_repo_name: citra-emu/citra-nightly