Skip to content

Commit

Permalink
Merging codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
headmelted committed May 27, 2017
1 parent 2e1cc7b commit a3c58ab
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 114 deletions.
72 changes: 7 additions & 65 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,19 @@ branches:
only:
- /^20.*$/
- master

# linux amd64 toolchain
include: &toolchain_linux_amd64
env:
- LABEL=amd64_linux
- ARCH=amd64
- GPP_COMPILER=g++-4.9
- GCC_COMPILER=gcc-4.9
- VSCODE_ELECTRON_PLATFORM=x64
- PACKAGE_ARCH=x64
addons:
apt:
sources:
- ubuntu-toolchain-r-test

# armhf toolchain
include: &toolchain_linux_armhf
env:
- LABEL=armhf_linux
- CROSS_TOOLCHAIN=true
- ARCH=armhf
- NPM_ARCH=arm
- GNU_TRIPLET=arm-linux-gnueabihf
- GNU_MULTILIB_TRIPLET=arm-linux-gnueabihf
- GPP_COMPILER=arm-linux-gnueabihf-g++
- GCC_COMPILER=arm-linux-gnueabihf-gcc
- VSCODE_ELECTRON_PLATFORM=arm
- PACKAGE_ARCH=armhf
- QEMU_ARCH=arm
- QEMU_ARCHIVE="http://archive.raspbian.org/raspbian"
- QEMU_IMAGE="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-04-10/2017-04-10-raspbian-jessie-lite.zip"
- QEMU_KERNEL="kernel7.img"
- QEMU_DTB="bcm2709-rpi-2-b.dtb"
- QEMU_MACHINE="raspi2"

# arm64 toolchain
include: &toolchain_linux_arm64
env:
- LABEL=arm64_linux
- CROSS_TOOLCHAIN=true
- ARCH=arm64
- NPM_ARCH=arm
- GNU_TRIPLET=aarch64-linux-gnu
- GNU_MULTILIB_TRIPLET=arm-linux-gnueabihf
- GPP_COMPILER=aarch64-linux-gnu-g++
- GCC_COMPILER=aarch64-linux-gnu-gcc
- VSCODE_ELECTRON_PLATFORM=arm
- PACKAGE_ARCH=arm64
- QEMU_ARCH=aarch64
- QEMU_IMAGE="https://dl.armbian.com/odroidc2/Ubuntu_xenial_default.7z"
- QEMU_KERNEL="Image"
- QEMU_DTB="meson64_odroidc2.dtb"
- QEMU_MACHINE="virt"


# armhf toolchain
include: &toolchain_linux_armhf_flatpak
env:
- LABEL=flatpak_armhf
- ARCH=armhf
- QEMU_ARCH=arm

# Travis CI build matrix. Each entry below will trigger an extra, parallel build on Travis.
matrix:
include:
- os: linux
<<: *toolchain_linux_amd64
env:
- LABEL="amd64_linux"
- os: linux
<<: *toolchain_linux_armhf
env:
- LABEL="armhf_linux"
- os: linux
<<: *toolchain_linux_arm64
env:
- LABEL="arm64_linux"

notifications:
email: false
Expand All @@ -88,7 +30,7 @@ script:
- export TRAVIS_BUILD_DIR=/workspace;
- if [[ "${TRAVIS_TAG}" =~ ^20.*$ ]]; then
export UBUNTU_VERSION="yakkety";
sudo bash -c ". /workspace/codebuilds-tools/all.sh";
sudo bash -c ". /workspace/codebuilds-tools/all.sh ${LABEL}";
else
if [[ "${LABEL}" == "armhf_linux" ]]; then
echo "Merging packages repository back up to Github Pages...";
Expand Down
12 changes: 7 additions & 5 deletions codebuilds-tools/all.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/bin/bash
set -e;

. /workspace/codebuilds-tools/environment.sh;
. /workspace/codebuilds-tools/setup_nvm.sh;
. /workspace/codebuilds-tools/build.sh;
. /workspace/codebuilds-tools/package.sh;
. ./codebuilds-tools/environment.sh $1;
. ./codebuilds-tools/setup_nvm.sh;
. ./codebuilds-tools/build.sh;
. ./codebuilds-tools/startxvfb.sh;

if [ "${CROSS_TOOLCHAIN}" == "true" ]; then
. /workspace/codebuilds-tools/qemu.sh "/workspace/codebuilds-tools/test-in-qemu.sh";
./codebuilds-tools/qemu.sh "codebuilds-tools/test-in-qemu.sh";
else
sudo bash -c ". /workspace/codebuilds-tools/install_package_and_test.sh";
fi;

. ./codebuilds-tools/package.sh;

# . /workspace/codebuilds-tools/startxvfb.sh;


Expand Down
6 changes: 3 additions & 3 deletions codebuilds-tools/environment.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
set -e

export CXX="${GPP_COMPILER}" CC="${GCC_COMPILER}" DEBIAN_FRONTEND="noninteractive";
export LABEL=$1;
./codebuilds-tools/environments/${LABEL}.sh;

echo "Deleting .nvm directory if it already exists...";
rm -rf .nvm;
export CXX="${GPP_COMPILER}" CC="${GCC_COMPILER}" DEBIAN_FRONTEND="noninteractive";

echo "Updating package repositories...";
apt update -yq;
Expand Down
9 changes: 9 additions & 0 deletions codebuilds-tools/environments/amd64_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e;

export LABEL=amd64_linux
export ARCH=amd64
export GPP_COMPILER=g++-4.9
export GCC_COMPILER=gcc-4.9
export VSCODE_ELECTRON_PLATFORM=x64
export PACKAGE_ARCH=x64
18 changes: 18 additions & 0 deletions codebuilds-tools/environments/arm64_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e;

export LABEL=arm64_linux;
export CROSS_TOOLCHAIN=true;
export ARCH=arm64;
export NPM_ARCH=arm;
export GNU_TRIPLET=aarch64-linux-gnu;
export GNU_MULTILIB_TRIPLET=arm-linux-gnueabihf;
export GPP_COMPILER=aarch64-linux-gnu-g++;
export GCC_COMPILER=aarch64-linux-gnu-gcc;
export VSCODE_ELECTRON_PLATFORM=arm;
export PACKAGE_ARCH=arm64;
export QEMU_ARCH=aarch64;
export QEMU_IMAGE="https://dl.armbian.com/odroidc2/Ubuntu_xenial_default.7z";
export QEMU_KERNEL="Image";
export QEMU_DTB="meson64_odroidc2.dtb";
export QEMU_MACHINE="virt";
19 changes: 19 additions & 0 deletions codebuilds-tools/environments/armhf_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e;

export LABEL=armhf_linux;
export CROSS_TOOLCHAIN=true;
export ARCH=armhf;
export NPM_ARCH=arm;
export GNU_TRIPLET=arm-linux-gnueabihf;
export GNU_MULTILIB_TRIPLET=arm-linux-gnueabihf;
export GPP_COMPILER=arm-linux-gnueabihf-g++;
export GCC_COMPILER=arm-linux-gnueabihf-gcc;
export VSCODE_ELECTRON_PLATFORM=arm;
export PACKAGE_ARCH=armhf;
export QEMU_ARCH=arm;
export QEMU_ARCHIVE="http://archive.raspbian.org/raspbian";
export QEMU_IMAGE="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-04-10/2017-04-10-raspbian-jessie-lite.zip";
export QEMU_KERNEL="kernel7.img";
export QEMU_DTB="bcm2709-rpi-2-b.dtb";
export QEMU_MACHINE="raspi2";
34 changes: 11 additions & 23 deletions codebuilds-tools/qemu.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e;

if [ ! -d "/workspace/.jail" ]; then
if [ ! -d "./.jail" ]; then

echo "Installing QEMU and dependencies...";
apt-get install -y debootstrap qemu-user-static binfmt-support sbuild;
Expand All @@ -10,25 +10,25 @@ if [ ! -d "/workspace/.jail" ]; then
ls /proc/sys/fs/;

echo "Creating ${ARCH} jail...";
mkdir /workspace/.jail;
mkdir ./.jail;

echo "Creating debootstrap...";
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential --arch=${ARCH} jessie /workspace/.jail ${QEMU_ARCHIVE}
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential --arch=${ARCH} jessie ./.jail ${QEMU_ARCHIVE}

echo "Copying static qemu into jail...";
sudo cp /usr/bin/qemu-${QEMU_ARCH}-static /workspace/.jail/usr/bin/
sudo cp /usr/bin/qemu-${QEMU_ARCH}-static ./.jail/usr/bin/

echo "Switching into jail...";
sudo chroot /workspace/.jail ./debootstrap/debootstrap --second-stage;
sudo chroot ./.jail ./debootstrap/debootstrap --second-stage;

echo "Creating jailed workspace...";
mkdir /workspace/.jail/workspace;
mkdir ./.jail/workspace;

echo "Mounting workspace into jail...";
sudo mount --bind /workspace /workspace/.jail/workspace;
sudo mount --bind /workspace ./.jail/workspace;

echo "Updating jail APT...";
sudo chroot /workspace/.jail apt-get update;
sudo chroot ./.jail apt-get update;

else

Expand All @@ -37,23 +37,11 @@ else
fi;

echo "Setting environment variables...";
echo "export LABEL=${LABEL}" >> /workspace/.jail/workspace/.env.sh;
echo "export CROSS_TOOLCHAIN=${CROSS_TOOLCHAIN}" >> /workspace/.jail/workspace/.env.sh;
echo "export ARCH=${ARCH}" >> /workspace/.jail/workspace/.env.sh;
echo "export NPM_ARCH=${NPM_ARCH}" >> /workspace/.jail/workspace/.env.sh;
echo "export GNU_TRIPLET=${GNU_TRIPLET}" >> /workspace/.jail/workspace/.env.sh;
echo "export GNU_MULTILIB_TRIPLET=${GNU_MULTILIB_TRIPLET}" >> /workspace/.jail/workspace/.env.sh;
echo "export GPP_COMPILER=${GPP_COMPILER}" >> /workspace/.jail/workspace/.env.sh;
echo "export GCC_COMPILER=${GCC_COMPILER}" >> /workspace/.jail/workspace/.env.sh;
echo "export VSCODE_ELECTRON_PLATFORM=${VSCODE_ELECTRON_PLATFORM}" >> /workspace/.jail/workspace/.env.sh;
echo "export PACKAGE_ARCH=${PACKAGE_ARCH}" >> /workspace/.jail/workspace/.env.sh;
echo "export QEMU_ARCH=${QEMU_ARCH}" >> /workspace/.jail/workspace/.env.sh;
echo "export UBUNTU_VERSION=${UBUNTU_VERSION}" >> /workspace/.jail/workspace/.env.sh;
echo "export HOME=/workspace" >> /workspace/.jail/workspace/.env.sh;
chmod a+x /workspace/.jail/workspace/.env.sh;
cp ./codebuilds-tools/environments/${LABEL}.sh ./.jail/workspace/.env.sh;
chmod a+x ./.jail/workspace/.env.sh;

echo "Executing script ($1) in jail...";
sudo chroot /workspace/.jail bash -c "cd /workspace && . ./.env.sh && echo 'Environment: \$(uname -a)' && echo 'Listing workspace in jail...' && ls /workspace && $1";
sudo chroot ./.jail bash -c "cd /workspace && ./.env.sh && echo 'Environment: \$(uname -a)' && echo 'Listing workspace in jail...' && ls /workspace && $1";

# echo "Mounting binfmt_misc...";
# mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc;
Expand Down
31 changes: 15 additions & 16 deletions codebuilds-tools/setup_nvm.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/bin/bash
set -e;

if [ ! -d /workspace/.nvm ]; then
echo "Removing old nvm if it exists...";
rm -rf .nvm;

echo "Installing nvm..."
git submodule update --init --recursive;
git clone --depth 1 https://github.com/creationix/nvm.git /workspace/.nvm;
. /workspace/.nvm/nvm.sh;
nvm install 7.4.0;
nvm use 7.4.0;
echo "Installing nvm..."
git submodule update --init --recursive;
git clone --depth 1 https://github.com/creationix/nvm.git .nvm;
. ./.nvm/nvm.sh;
nvm install 7.4.0;
nvm use 7.4.0;
nvm alias default 7.4.0;

echo "Setting python binding...";
npm config set python `which python`;
echo "Setting python binding...";
npm config set python `which python`;

echo "Installing gulp...";
npm install -g gulp;

else
echo "Installing npm dependencies...";
npm install -g gulp @emmetio/node;

echo "nvm already exists, skipping...";

fi;
echo "Installing local emmetio/node...";
npm install @emmetio/node;
4 changes: 2 additions & 2 deletions codebuilds-tools/test-in-qemu.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e;

. /workspace/codebuilds-tools/setup_nvm.sh;
. /workspace/codebuilds-tools/install_package_and_test.sh;
. ./codebuilds-tools/setup_nvm.sh;
. ./codebuilds-tools/install_package_and_test.sh;

0 comments on commit a3c58ab

Please sign in to comment.