Commit edad02fc authored by carlosperate's avatar carlosperate

Adding AppVeyor Windows build server:

* Add configuration file for AppVeyor.
* Updated pack_ardublockly to check for AppVeyor environmental variables.
* Update pack_ardublockly to always include timestamp.
* Update package README with better build info.
* Update package README with AppVeyor badge.

This is a squashed commit from the appveyor-config branch.
parent fe877974
environment:
matrix:
# First group is 32 bit python 2.7
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.9"
PYTHON_ARCH: "32"
platform: x86
configuration: Release
init:
- cmd: ECHO Processor architecture - %PROCESSOR_ARCHITECTURE%
- cmd: wmic OS get OSArchitecture
# As AppVeyor has multiple python install, verify which one uses by default
- cmd: ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
- cmd: python --version
- cmd: python -c "import struct; print(struct.calcsize('P') * 8)"
# Set the relevant pip location to the path
- cmd: set PATH=%PYTHON%\scripts;%PATH%
- cmd: ECHO Path - %PATH%
install:
# Git clone happens between init and install
- cmd: git submodule update --init --recursive
# Install python dependencies
- cmd: pip install https://dl.dropboxusercontent.com/u/74034/ardublockly-dep/win/py2exe-0.6.10a1-cp27-none-win32.whl
- cmd: pip install https://dl.dropboxusercontent.com/u/74034/ardublockly-dep/win/cefpython3-31.2-cp27-none-win32.whl
- cmd: pip install https://dl.dropboxusercontent.com/u/74034/ardublockly-dep/win/wxPython-3.0.2.0-cp27-none-win32.whl
- cmd: pip install https://dl.dropboxusercontent.com/u/74034/ardublockly-dep/win/wxPython_common-3.0.2.0-py2-none-any.whl
- cmd: pip install mock
# Build Ardublockly
- cmd: python package\build_windows.py
- cmd: python package\pack_ardublockly.py
- cmd: dir
# Not a project with an msbuild file, build done at install.
build: off
# For now a simple test that we know passes
test_script:
- cmd: python ArdublocklyServer\tests\SketchCreator_test.py
# Create artifact for the Ardubockly build
artifacts:
- path: '*\*.zip'
name: ardublockly-zip
type: zip
# List artifacts
before_deploy:
- ps: foreach($artifactName in $artifacts.keys) { $artifacts[$artifactName] }
# Deploy build to Amazon S3 bucket
deploy:
provider: S3
access_key_id: AKIAIWAS6AEEZDXQUNTA
secret_access_key:
secure: 3Ewa1E9tDLawiGZvbUA3NbuGkK/uKw+zrQXtBPeZwd/pS4EHL0k0bu2n9hf7M9Cs
bucket: ardublockly-builds
set_public: true
folder: windows
artifact: ardublockly-zip
......@@ -5,24 +5,28 @@ Currently the Windows build is created using py2exe and the Linux and Mac OS X b
## Download the packaged Ardublockly
The stable binaries for Windows, Linux an Mac OS X are hosted in GitHub as part of the [repository releases][1].
The stable binaries for Windows, Linux, and Mac OS X are hosted in GitHub as part of the [repository releases][1].
Development builds are frequently triggered in a build server and hosted in the following link: [Dev builds][10]
Development builds are frequently triggered in build servers and hosted in the following link: [Dev builds][10]
Linux build status: [![Build Status](https://travis-ci.org/carlosperate/ardublockly.svg?branch=master)](https://travis-ci.org/carlosperate/ardublockly)
Linux build status: [![Linux Build Status](https://travis-ci.org/carlosperate/ardublockly.svg?branch=master)](https://travis-ci.org/carlosperate/ardublockly)
Windows build status: [![Windows Build status](https://ci.appveyor.com/api/projects/status/t877g920hdiifc2i?svg=true)](https://ci.appveyor.com/project/carlosperate/ardublockly)
## Building Ardublockly from source
These build scripts only work on Python 2.7.
Git also needs to be installed on the system.
## Ardublockly source code dependencies
While the non-GUI version of Ardublockly (command line server + system browser) is compatible with other Python versions (tested on Python 2.7 and 3.4), due to the individual perks of the python libraries used here and unavailability of CEF Python 3 bindings, a single build environment based on Python 2.7 will be targeted.
### Git
Git needs to be installed on the system and accessible through the command line interface.
If you are using Python virtual environments on Windows this [collection of Python extensions binaries][2] is highly recommended.
### Python
These build scripts only work on Python 2.7.
While the non-GUI version of Ardublockly (command line server + pre-installed browser) is compatible with other Python versions (tested on Python 2.7 and 3.4), due to the individual perks of the python libraries used here and unavailability of CEF Python 3 bindings, a single build environment based on Python 2.7 will be targeted.
If you are using Python virtual environments on Windows this [collection of Python extensions binaries][2] is highly recommended.
### Python dependencies
The specific versions of the Python dependencies can be found in the [requirements.txt][3] file.
#### cefpython3
......@@ -44,14 +48,16 @@ You can download wxPython from their [official website][4].
#### py2exe
py2exe is a Distutils extension to build Python scripts into Windows executable programs.
This package is only required for the Windows build. The Linux and Mac OS X builds use PyInstaller.
This package is only required for the Windows build. The Linux and Mac OS X builds use the PyInstaller scripts included in this folder.
You can download py2exe from their [official website][6].
#### PyInstaller
Converts (packages) Python programs into stand-alone executables, used for the Linux and Mac OS X builds.
You can download PyInstaller from the official [repository wiki][9]. As the version stored in Pypi is quite old, pip would install an outdated version that won't work with the current specs file.
This package does not need to be installed, as it is already included in this folder.
This version of PyInstaller is from the official [repository wiki][9]. As the version stored in Pypi is quite old, pip would install an outdated version that won't work with the current specs file.
#### MkDocs
MkDocs is a static page generator specifically designed for documentation using Markdown.
......@@ -73,19 +79,15 @@ Download and initialise this project repository:
```
git clone https://github.com/carlosperate/ardublockly.git
cd ardublockly
git submodule init
git submodule update
git submodule update --init --recursive
```
Now navigate to the `package` folder in the project directory:
If you have already downloaded the Ardublockly source code, make sure the submodules are initialise, in this case the 'closure-library' in the project root directory and 'pyinstaller' in the package folder. You can run `git submodule update --init --recursive` in the project root to ensure this is the case, otherwise the submodule directories will be empty.
```
cd package
```
To first build the offline documentation execute the `build_docs.py` file. This will add a folder named `documentation` into the project root directory:
First build the offline documentation by running the `build_docs.py` script from within the package folder. This will add a folder named `documentation` into the project root directory:
```
cd package
python build_docs.py
```
......@@ -93,25 +95,48 @@ The build steps for Ardublockly are slightly different depending on the platform
### Windows Build
To build Ardublockly under windows all you have to do is execute the `build_windows.py` file from the `package` directory :
To build Ardublockly under Windows all you have to do is execute the `build_windows.py` file from the project root directory:
```
python build_windows.py
python package\build_windows.py
```
This will remove any previous build directory (`/win` directory in project root), rebuild, and create the `ardublockly_run.bat` file into the project root.
This will remove any previous build directory, rebuild, and create the `ardublockly_run.bat` file into the project root.
To run Ardublockly on Windows execute the `ardublockly_run.bat` file.
### Linux Build
This part of the documentation is still under work.
To build Ardublockly under Linux all you have to do is execute the `build_linux.py` file from the project root directory:
```
python package/build_linux.py
```
This will remove any previous build directory, rebuild, and create the `ardublockly_run.sh` file into the project root.
To run Ardublockly on Linux execute the `ardublockly_run.sh` bash file. Don't forget set the file as executable to be able to run it from your desktop environment.
### Mac OS X Build
This part of the documentation is still under work.
## Packing Ardublockly
Once the project is build there are a few unnecessary files that can be removed to save space.
You can pack ardublockly running the following command from the project root directory:
```
python package/pack_ardublockly.py
```
The pack script was designed for the build servers to zip the required contents into a single file to be uploaded to cloud storage, so it still leaves quite a few things behind. This script creates a new folder on the same level a the project root, and then zips it and saves it into the folder 'upload' within the project root.
## Script files descriptions:
This part of the documentation is still under work.
[1]: https://github.com/carlosperate/ardublockly/releases/
[2]: http://www.lfd.uci.edu/~gohlke/pythonlibs/
[3]: requirements.txt
......
......@@ -22,7 +22,7 @@
#
# This script file will create a copy of the project folder in its parent folder
# So if project folder is located in ~/projects/ardublockly it will create a
# copy in ~/projects/ardublockly_<tag>.
# copy in ~/projects/ardublockly_<timestamp>_<tag>.
# It will then delete unnecessary files for a working version of the self
# executable application and zip the contents of the folder.
#
......@@ -140,52 +140,89 @@ def pack_ardublockly(tag):
zip_ardublockly_copy(tag)
def tag_from_travis_env_vars():
def tag_from_ci_env_vars(ci_name, pull_request_var, branch_var, commit_var):
"""
Checks if the Travis-CI environmental variables to check for a pull request,
Checks if the CI environmental variables to check for a pull request,
commit id and band commit branch are present.
:return: String with the Travis build information, or None if the Travis-CI
:return: String with the CI build information, or None if the CI
environmental variables could not be found.
"""
travis_pull_request = os.environ.get("TRAVIS_PULL_REQUEST")
travis_branch = os.environ.get("TRAVIS_BRANCH")
travis_commit = os.environ.get("TRAVIS_COMMIT")
if travis_pull_request:
if travis_pull_request != "false":
return travis_pull_request
elif travis_branch and travis_commit:
return "%s_%s" % (travis_branch, travis_commit)
else:
print(script_tab + "TRAVIS_BRANCH or TRAVIS_COMMIT Travis-CI"
"environmental variables not found.")
return None
else:
print(script_tab + "TRAVIS_PULL_REQUEST Travis-CI environmental "
"variable not found.")
return None
pull_request = os.environ.get(pull_request_var)
branch = os.environ.get(branch_var)
commit = os.environ.get(commit_var)
if pull_request and pull_request != "false":
try:
int(pull_request)
print(script_tab + "Pull request valid '%s' variable found: %s" %
(ci_name, pull_request))
return "pull_%s" % pull_request
except ValueError:
print(script_tab + "The pull request environmental variable " +
"'%s' value '%s' from %s is not a valid number." %
(pull_request_var, pull_request, ci_name))
if branch and commit:
print(script_tab + "Branch and commit valid '%s' variables found: %s %s"
% (ci_name, branch, commit))
# We only return first 10 digits from the commit ID (normal length 40)
commit = "%s" % commit
return "%s_%s" % (branch, commit[:10])
print(script_tab + "The environmental variables for %s " % ci_name +
"were deemed invalid:\n" +
script_tab + "\t%s: %s\n" % (pull_request_var, pull_request) +
script_tab + "\t%s: %s\n" % (branch_var, branch) +
script_tab + "\t%s: %s" % (commit_var, commit))
return None
def get_tag():
"""
The tag will always contain the timestamp. If provided as a command line
argument it will add an additional string, if not it will check for
environmental variables set in build servers to create an identification
tag.
:return: String with the final tag.
"""
# All tags begging with the current time stamp
time_stamp = time.strftime("%Y-%m-%d_%H.%M.%S")
def main():
print(script_tag + "Pack Ardublockly script started.")
print(script_tag + "Checking command line arguments for tag:")
# Check if a command line argument has been given
if len(sys.argv) > 1:
# Take the first argument and use it as a filename tag
tag = sys.argv[1]
# Take the first argument and use it as a tag appendage
print(script_tab + "Command line argument '%s' found and will be used "
"for package tag." % sys.argv[1])
return "%s_%s" % (time_stamp, sys.argv[1])
else:
print(script_tab + "No command line argument found")
print(script_tag + "Checking Travis-CI environment variables for tag:")
tag = tag_from_travis_env_vars()
if not tag:
# If the Travis-CI environmental variables are not present then
# use the current time stamp
tag = time.strftime("%Y-%m-%d_%H.%M.%S")
print(script_tag + "No Travis-CI environment variables found, so "
"using current timestamp for tag: %s" % tag)
# Check for Travis-CI environmental variables to create tag appendage
print(script_tab + "Checking Travis-CI environment variables for tag:")
travis_tag = tag_from_ci_env_vars(ci_name="Travis-CI",
pull_request_var="TRAVIS_PULL_REQUEST",
branch_var="TRAVIS_BRANCH",
commit_var="TRAVIS_COMMIT")
if travis_tag:
return "%s_%s" % (time_stamp, travis_tag)
# Check for AppVeyor environmental variables to create tag appendage
print(script_tab + "Checking AppVeyor environment variables for tag:")
appveyor_tag = tag_from_ci_env_vars(
ci_name="AppVeyor",
pull_request_var="APPVEYOR_PULL_REQUEST_NUMBER",
branch_var="APPVEYOR_REPO_BRANCH",
commit_var="APPVEYOR_REPO_COMMIT")
if appveyor_tag:
return "%s_%s" % (time_stamp, appveyor_tag)
return time_stamp
def main():
print(script_tag + "Pack Ardublockly script started.")
print(script_tag + "Checking for tag to attach to zip file:")
tag = get_tag()
pack_ardublockly(tag)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment