Skip to content

Commit

Permalink
ci: package Linux artifacts as AppImage
Browse files Browse the repository at this point in the history
ci: disable signing for PR builds
  • Loading branch information
JaCzekanski committed May 11, 2020
1 parent 93580f3 commit 90f910b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 14 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,33 @@ git:
matrix:
include:
- name: Linux Clang6
env: SKIP_DEPLOY=skip
os: linux
dist: bionic
services: docker
script: "./.travis/linux/run-container.sh 6"
- name: Linux Clang8
env: SKIP_DEPLOY=skip
os: linux
dist: bionic
services: docker
script: "./.travis/linux/run-container.sh 8"
- name: Linux Clang10
os: linux
dist: bionic
services: docker
script: "./.travis/linux/run-container.sh 10"
- name: Android
os: linux
dist: bionic
services: docker
before_install: openssl aes-256-cbc -K $encrypted_7333c7dd5b15_key -iv $encrypted_7333c7dd5b15_iv -in android/avocado.keystore.enc -out android/avocado.keystore -d
script: "./.travis/android/run-container.sh"
- name: macOS
os: osx
osx_image: xcode11
install: "./.travis/macos/install-dependencies.sh"
script: "./.travis/macos/build.sh"


after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL"
after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL"

Expand Down
11 changes: 8 additions & 3 deletions .travis/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@

cd /home/build

export BUILD_MODE=release
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
export BUILD_MODE=debug
fi

export OS=android
export DATE=`date +%Y%m%d`
export COMMIT=`git rev-parse --short=7 HEAD`
export ARTIFACT=avocado-$OS-$DATE-$COMMIT.apk
export ASSETS_DIR=android/app/src/main/assets
export TARGET_DIR=android/app/build/outputs/apk/release
export TARGET_DIR=android/app/build/outputs/apk/$BUILD_MODE
export NDK_CCACHE="$(which ccache)"

# Configure cache
Expand All @@ -23,12 +28,12 @@ find $ASSETS_DIR -type f -name .gitignore -exec rm {} \;

# Build
pushd android
./gradlew assembleRelease
./gradlew assemble$BUILD_MODE
popd

# Tests
# No test suite for Android right now

# Package and prepare upload artifact
mkdir -p upload
cp $TARGET_DIR/app-release.apk upload/$ARTIFACT
cp $TARGET_DIR/app-$BUILD_MODE.apk upload/$ARTIFACT
5 changes: 5 additions & 0 deletions .travis/android/run-container.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash -ex
# Run in Travis to launch container

# Setup signing
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
openssl aes-256-cbc -K $encrypted_7333c7dd5b15_key -iv $encrypted_7333c7dd5b15_iv -in android/avocado.keystore.enc -out android/avocado.keystore -d
fi

mkdir -p "$HOME/.ccache"

docker run \
Expand Down
19 changes: 13 additions & 6 deletions .travis/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export CXX="ccache c++ -fcolor-diagnostics"
# Configure cache
ccache --set-config=sloppiness=pch_defines,time_macros

# Download SDL2
apt -qq update
apt -qq install -y --no-install-recommends libsdl2-dev > /dev/null

# Generate Makefile
premake5 gmake

Expand All @@ -32,11 +28,22 @@ wget -nv https://gist.github.com/JaCzekanski/d7a6e06295729a3f81bd9bd488e9d37d/ra

# Package
mkdir -p $ARTIFACT
cp build/release_x64/avocado $ARTIFACT/avocado
cp -r data $ARTIFACT/
cp android/app/src/main/ic_launcher-web.png $ARTIFACT/avocado.png

# Remove .gitignore
find $ARTIFACT -type f -name .gitignore -exec rm {} \;

wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x ./linuxdeploy-x86_64.AppImage

APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy-x86_64.AppImage \
--appdir=$ARTIFACT \
--executable=./build/release_x64/avocado \
--create-desktop-file \
--icon-file=$ARTIFACT/avocado.png \
--output=appimage

# Upload
mkdir -p upload
tar -zcf upload/$ARTIFACT.tar.gz $ARTIFACT
mv avocado-*.AppImage upload/
3 changes: 1 addition & 2 deletions .travis/linux/run-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ docker run \
-v $(pwd):/home/build \
-v "$HOME/.ccache":/root/.ccache \
avocadoemu/linux-clang$CLANG_VERSION \
/bin/bash -ex /home/build/.travis/linux/build.sh

/bin/bash -ex /home/build/.travis/linux/build.sh
1 change: 1 addition & 0 deletions src/platform/windows/gui/helper/file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <array>
#include <string>
#include <map>
#include <vector>
#include "platform/windows/gui/filesystem.h"

namespace gui::helper {
Expand Down
4 changes: 3 additions & 1 deletion src/platform/windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ void fatalError(const std::string& error) {

void changeWorkingDirectory() {
std::string workingDirectory = ".";
#ifdef ANDROID
#if defined(__linux__)
return; // AppImage, no change
#elif defined(ANDROID)
workingDirectory = "/sdcard/avocado";
#else
char* basePath = SDL_GetBasePath();
Expand Down

0 comments on commit 90f910b

Please sign in to comment.