Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
05762c6
First version of install script
btimbermont Mar 17, 2025
fadc8b0
74: Make sure appium inspector is added to the path correctly
eoudsen Mar 18, 2025
e19e5d0
74-create-install-script: Copy workshop install scripts
Angelina-C Mar 24, 2025
715dd8a
74-create-install-script: Merge branch '74-create-install-script' of …
Angelina-C Mar 24, 2025
c18d689
74-create-install-script: Rename workshop_env to python_env and remov…
Angelina-C Mar 24, 2025
2335bae
74-create-install-script: Remove git, checkout, ipython from windows
Angelina-C Mar 24, 2025
4dec622
74-create-install-script: remove url
Angelina-C Mar 24, 2025
260186c
Add check for correct python version in Linux script
btimbermont Mar 24, 2025
f9a0c99
Merge remote-tracking branch 'origin/74-create-install-script' into 7…
btimbermont Mar 24, 2025
b60921d
74-create-install-script: Make all linux scripts executable
Angelina-C Mar 24, 2025
f0a3673
Fix windows install script
btimbermont Mar 24, 2025
9bf1da3
Merge branch '74-create-install-script' of https://github.com/Netherl…
btimbermont Mar 24, 2025
e6aaa7f
Add adb to path
btimbermont Mar 24, 2025
80b0ba2
74-create-install-script: create funciton for env variables
Angelina-C Mar 24, 2025
94191da
74-create-install-script: Merge branch '74-create-install-script' of …
Angelina-C Mar 24, 2025
299813b
74-create-install-script: Fix python3.x installation
Angelina-C Mar 24, 2025
ea3bdf9
74-create-install-script: Remove todos
Angelina-C Mar 24, 2025
8c53cc2
Set Linux env values for adb
btimbermont Mar 24, 2025
9befce6
Merge remote-tracking branch 'origin/74-create-install-script' into 7…
btimbermont Mar 24, 2025
acd5f8a
74-create-install-script: Check env variables in mac
Angelina-C Mar 24, 2025
d309eac
Rewrite manual for installation scripts
btimbermont Mar 24, 2025
2ed5f88
Merge remote-tracking branch 'origin/74-create-install-script' into 7…
btimbermont Mar 24, 2025
e76e1fe
Merge branch 'main' into 74-create-install-script
btimbermont Mar 24, 2025
0e66692
Fix typos in install readme
Angelina-C Mar 24, 2025
9a36809
Write windows install logs to file
Angelina-C Mar 24, 2025
8119037
Revert "Write windows install logs to file"
Angelina-C Mar 24, 2025
5df5329
Small fix in windows install script
btimbermont Mar 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 3 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ of existing apps are welcome! If you want to contribute, please read [CONTRIBUTI
## Getting started

1. Install all required software (see the [requirements](#requirements) section).
- install [ADB](#ADB)
- install [Appium](#Appium)
2. Connect your Android device (or start an emulator), make sure it is connected properly over ADB (See the section on
[troubleshooting](#Troubleshooting) if you encounter problems).
- :warn: Make sure the phone is set to English, and [all other requirements](#android-device--s--or-emulators) are met!
Expand Down Expand Up @@ -144,60 +142,10 @@ argument only once, and then sticking to `send_message` without the secondary ar

## Requirements

### OS
## Install dependencies

Puma is developed and tested on Linux and Windows. MacOS is not tested by us, but might work.

### Python

Puma is tested on Python 3.10 and 3.11, we haven't tested other versions.
Download Python [here](https://www.python.org/downloads/) or install it using apt:
```shell
sudo apt install python3.11
```

### ADB

Puma uses ADB to connect to Android devices for some features, both directly and through Appium.
To install ADB, download [the Android Sdk Platform Tools](https://developer.android.com/tools/releases/platform-tools).
Create the directory `~/Android/Sdk/` and unzip the platform-tools in this folder, so the absolute path to adb becomes
`~/Android/Sdk/platform-tools/adb`. Then create the environmental value `ANDROID_SDK_ROOT` with the value
`~/Android/Sdk/`:

```shell
$ echo 'export ANDROID_SDK_ROOT="$HOME/Android/Sdk/"' >> ~/.bashrc
$ echo 'export PATH="$PATH:$HOME/Android/Sdk/platform-tools"' >> ~/.bashrc
$ source ~/.bashrc
```

> :warning: When running your Appium script from an IDE, you might get the error `Could not determine ANDROID_SDK_ROOT.`
> This is because the IDE might not load the environment variables correctly. Since Puma then defaults to ~/Android/Sdk,
> you will not need to do anything if you followed the steps above, and you can ignore this message. If you really want
> to use another location, please refer to you IDE specific documentation how to set environment variables.

### Appium

Apps are controlled through Appium. See the [Appium website](https://appium.io/docs/en/2.0/quickstart/install/) or below
how to install Appium, Appium v2.0 or greater is needed to run Puma.

Appium is a NodeJS application which can be installed through NPM.
If you don't have NPM installed, we recommend installing NPM and Node using NVM, an application to manage your NodeJS
installation.

```shell
sudo apt install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 19.0.0
source ~/.bashrc # Or restart shell to activate path
```
If you have NPM installed you can install Appium:

```shell
npm install -g appium
appium driver install uiautomator2
```

_See [troubleshooting](#installing-appium-with-npm-fails) if installing Appium or npm fails._
First off, run the installation scripts in the `install` folder.
See [the installation manual](install/README_INSTALLATION.md) for more details.

### Android Device(s) or Emulators
You can either use a physical Android device or an Android emulator. See [Optional: Android Studio](#optional--android-studio--for-running-an-emulator-) for instructions on installing Android Studio and running an emulator
Expand Down
42 changes: 42 additions & 0 deletions install/README_INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Installation script instructions

To install all required dependencies and configure your machine to run Puma, simply run the installation script for your
operating system (`install_windows.bat`, `install_linux.sh` or `install_macos.sh`).

# What does the script do?

These scripts will:
1. Install ADB and setup the required environmental values
2. Install NodeJS and Appium
3. Install Python 3.12
4. Install Appium Inspector
5. Install all requirements in your python virtual environment

When software is installed (ADB, Node, Appium, Python, Appium Inspector), the scripts will only install the missing
components. Python 3.12 will not be installed if you already have python 3.10, 3.11 or 3.12 installed.

## ADB and environmental values
Puma needs ADB to be installed and either be available on your path, or on `ANDROID_SDK_ROOT/platform-tools/adb`.
Appium **requires** the environmental values `ANDROID_SDK_ROOT` or `ANDROID_HOME` to be set.

The script will set these values if they aren't already set, and download the latest Android SDK platform tools and
extract them to your home folder (`~/Android/Sdk/platform-tools/adb`) .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extract them to your home folder (`~/Android/Sdk/platform-tools/adb`) .
extract them to your home folder (`~/Android/Sdk/platform-tools/adb`).


## NodeJS and Appium
Puma needs Appium, which is a Node.JS application.
The script will install Node.JS (through NVM on Linux and MacOS) and then use NPM to install Appium globally.

## Python
Puma is tested on Python 3.10, 3.11 and 3.12. The script will install 3.12 if none of these versions are installed.

## Appium inspector
Appium Inspector is a tool that can help you develop new Puma code, either for new apps, or to expand functionality in
existing apps.

On Windows and MacOS, it will be installed as a regular application (through an installer), on Linux a portable binary
will be placed in `~/.appium-inspector/appium-inspector.AppImage` and an alias will be made so you can run it from
the terminal using `appium_inspector`.

## Installing requirements in the python virtual environment
The script will create and activate [a python venv](https://docs.python.org/3/library/venv.html) in the root of this
repository, and then run `pip install -r requirements.txt`.
33 changes: 33 additions & 0 deletions install/common/get_shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
Comment thread
eoudsen marked this conversation as resolved.

shell_profile() {
SHELL_PROFILE=""
case "$SHELL" in
*bash*)
SHELL_PROFILE="$HOME/.bash_profile"
if [ ! -f "$SHELL_PROFILE" ]; then
SHELL_PROFILE="$HOME/.bashrc"
fi
;;
*zsh*)
SHELL_PROFILE="$HOME/.zshrc"
;;
*ksh*)
SHELL_PROFILE="$HOME/.kshrc"
;;
*fish*)
SHELL_PROFILE="$HOME/.config/fish/config.fish"
;;
*dash*)
SHELL_PROFILE="$HOME/.profile"
;;
*sh*)
SHELL_PROFILE="$HOME/.profile"
;;
*)
echo "Unsupported shell: $CURRENT_SHELL"
exit 1
;;
esac
echo "$SHELL_PROFILE"
}
27 changes: 27 additions & 0 deletions install/install_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
CURRENT_DIR=$(dirname "$(realpath "$0")")

# Exit on error
set -e

echo "Starting setup of Android SDK Platform Tools, Node.js, and Appium for Linux..."
now=$(date +"%Y%m%d_%H:%M:%S")
mkdir -p "$CURRENT_DIR/logs"
log_path="$CURRENT_DIR/logs/$now.log"
touch "$log_path"

"$CURRENT_DIR"/linux/install_adb.sh | tee -a "$log_path"
"$CURRENT_DIR"/linux/install_node_appium.sh | tee -a "$log_path"
"$CURRENT_DIR"/linux/install_appium_inspector.sh | tee -a "$log_path"
"$CURRENT_DIR"/linux/setup_python_env.sh | tee -a "$log_path"

echo "Installation complete!"
echo "To verify the installation, please open a new terminal and run:"
echo "- adb version (to check Android SDK Platform Tools)"
echo "- node -v (to check Node.js version - should be v19.x.x)"
echo "- appium -v (to check Appium version)"
echo "- appium_inspector (to launch Appium Inspector)"
echo ""
echo "Note: You may need to install additional dependencies for AppImage to run properly."
echo "If you encounter errors running appium_inspector, try installing:"
echo "sudo apt-get install libfuse2"
25 changes: 25 additions & 0 deletions install/install_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
CURRENT_DIR=$(dirname "$(realpath "$0")")

# Exit on error
set -e

echo "Starting setup of Android SDK Platform Tools, Node.js, Appium, and Git for macOS..."
now=$(date +"%Y%m%d_%H:%M:%S")
mkdir -p "$CURRENT_DIR/logs"
log_path="$CURRENT_DIR/logs/$now.log"
touch "$log_path"

"$CURRENT_DIR"/macos/install_adb.sh | tee -a "$log_path"
"$CURRENT_DIR"/macos/install_node_appium.sh | tee -a "$log_path"
"$CURRENT_DIR"/macos/install_appium_inspector.sh | tee -a "$log_path"
"$CURRENT_DIR"/macos/setup_python_env.sh | tee -a "$log_path"

#TODO actually check instead of print
echo "Installation complete!"
echo "To verify the installation, please open a new terminal and run:"
echo "- adb version (to check Android SDK Platform Tools)"
echo "- node -v (to check Node.js version - should be v19.x.x)"
echo "- appium -v (to check Appium version)"
echo "- open -a 'Appium Inspector' (to launch Appium Inspector)"
echo "- git --version (to check Git version)"
105 changes: 105 additions & 0 deletions install/install_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
@echo off
cd /d "%~dp0\windows"

:: Initialize success flags
set "python_success=false"
set "adb_success=false"
set "node_success=false"
set "setup_python_env_success=false"
set "appium_install_success=false"
set "appium_inspector_install_success=false"

:: Run Python installation script
echo Running Python installation...
call install_python.bat
IF %ERRORLEVEL% EQU 0 (
set "python_success=true"
) ELSE (
echo Python installation failed.
)

:: Run ADB installation script
echo Running ADB installation...
call install_adb.bat
IF %ERRORLEVEL% EQU 0 (
set "adb_success=true"
) ELSE (
echo ADB installation failed.
)

:: Run Node.js installation script
echo Running Node.js installation...
call install_node.bat
IF %ERRORLEVEL% EQU 0 (
set "node_success=true"
) ELSE (
echo Node.js installation failed.
)

:: Install Appium
echo Running Appium installation...
call install_appium.bat
IF %ERRORLEVEL% EQU 0 (
set "appium_install_success=true"
) ELSE (
echo Appium installation failed.
)

:: Install Appium Inspector
echo Running Appium Inspector installation...
call install_appium_inspector.bat
IF %ERRORLEVEL% EQU 0 (
set "appium_inspector_install_success=true"
) ELSE (
echo Appium Inspector installation failed.
)

:: Run python setup
echo Running python environment setup...
call setup_python_env.bat
IF %ERRORLEVEL% EQU 0 (
set "setup_python_env_success=true"
) ELSE (
echo Python environment setup failed.
)

:: Summary of installations
echo
echo ----------------------
echo Installation Summary:
echo ----------------------

IF "%python_success%"=="true" (
echo Python installation succeeded.
) ELSE (
echo Python installation failed.
)

IF "%adb_success%"=="true" (
echo ADB installation succeeded.
) ELSE (
echo ADB installation failed.
)

IF "%node_success%"=="true" (
echo Node.js installation succeeded.
) ELSE (
echo Node.js installation failed.
)
IF "%appium_install_success%"=="true" (
echo Appium installation succeeded.
) ELSE (
echo Appium installation failed.
)
IF "%appium_inspector_install_success%"=="true" (
echo Appium Inspector installation succeeded.
) ELSE (
echo Appium Inspector installation failed.
)
IF "%setup_python_env_success%"=="true" (
echo Puma environment setup succeeded.
) ELSE (
echo Puma environment setup failed.
)

pause
61 changes: 61 additions & 0 deletions install/linux/install_adb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
# Exit on error
set -e

echo "Starting install of android-sdk and platform-tools"

# Set up environment variables
echo "Setting up environment variables..."
ENV_SETUP="
# Android SDK Environment Variables
export ANDROID_HOME=\$HOME/Android/Sdk
export ANDROID_SDK_ROOT=\$HOME/Android/Sdk
export PATH=\$PATH:\$ANDROID_HOME/platform-tools
"

echo "Setting environment variables"

current_dir=$(dirname "$(realpath "$0")")
source "$current_dir"/../common/get_shell.sh
SHELL_PROFILE=$(shell_profile)

if [ -n "$SHELL_PROFILE" ]; then
# Check if variables already exist in the profile
if ! grep -q "ANDROID_HOME" "$SHELL_PROFILE"; then
echo "$ENV_SETUP" >> "$SHELL_PROFILE"
echo "Added environment variables to $SHELL_PROFILE"
else
echo "Environment variables already exist in $SHELL_PROFILE"
fi
else
echo "Warning: Could not find shell profile. You may need to manually add environment variables."
echo "Please add the following to your shell profile:"
echo "$ENV_SETUP"
fi

source "$SHELL_PROFILE"

# setup adb
ANDROID_SDK_DIR="$HOME/Android/Sdk"
if [ -e "$ANDROID_SDK_DIR/platform-tools/adb" ]
then
echo "[INFO] ADB is already installed. Skipping installation"
exit 0
fi

ANDROID_SDK_DIR=$HOME/Android/Sdk
TEMP_DIR=$(mktemp -d)

# Create Android SDK directory
mkdir -p "$ANDROID_SDK_DIR"

# Download and extract Android SDK Platform Tools
echo "Downloading Android SDK Platform Tools..."
PLATFORM_TOOLS_URL="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
curl -L $PLATFORM_TOOLS_URL -o "$TEMP_DIR"/platform-tools.zip

echo "Extracting Platform Tools to $ANDROID_SDK_DIR..."
unzip -q "$TEMP_DIR"/platform-tools.zip -d "$ANDROID_SDK_DIR"

echo "Cleaning up temporary files..."
rm -rf "$TEMP_DIR"
Loading