Browse Source

Refine Travis CI build scripts for Raspberry Pi

master
Krisjanis Rijnieks 7 years ago
parent
commit
e9cfd7b134
  1. 17
      .travis.yml
  2. 8
      scripts/ci/rpi/build-script.sh
  3. 2
      scripts/ci/rpi/build.sh
  4. 8
      scripts/ci/rpi/finalize-script.sh
  5. 12
      scripts/ci/rpi/prepare-script.sh
  6. 2
      scripts/ci/rpi/prepare.sh

17
.travis.yml

@ -3,6 +3,7 @@ env:
- PATH=$HOME/.local/bin:$PATH - PATH=$HOME/.local/bin:$PATH
- AWS_BUCKET="ofxpimapper" - AWS_BUCKET="ofxpimapper"
- AWS_SHARED="~/shared" - AWS_SHARED="~/shared"
- IMAGE="opm-${TRAVIS_TAG}.img"
git: git:
depth: 1 depth: 1
@ -13,11 +14,11 @@ before_install:
jobs: jobs:
include: include:
- stage: addons - stage: prepare
os: linux os: linux
dist: trusty dist: trusty
sudo: required sudo: required
env: IMAGE="opm-${TRAVIS_TAG}.img" RPI_ZIP="raspbian_lite-2017-07-05-of_v0.9.8.img.zip" RPI_URL="https://github.com/kr15h/openframeworks-rpi-image/releases/download/v1.0.2/${RPI_ZIP}" env: RPI_ZIP="raspbian_lite-2017-07-05-of_v0.9.8.img.zip" RPI_URL="https://github.com/kr15h/openframeworks-rpi-image/releases/download/v1.0.2/${RPI_ZIP}"
addons: addons:
apt: apt:
packages: packages:
@ -29,15 +30,14 @@ jobs:
- dosfstools - dosfstools
- zip - zip
script: script:
- sudo bash ./scripts/ci/rpi/addons.sh - sudo bash ./scripts/ci/rpi/prepare.sh
- zip "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}" - zip "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}"
- aws s3 rm "s3://${AWS_BUCKET}" --recursive - aws s3 rm "s3://${AWS_BUCKET}" --recursive
- aws s3 sync "${AWS_SHARED}" "s3://${AWS_BUCKET}" - aws s3 sync "${AWS_SHARED}" "s3://${AWS_BUCKET}"
- stage: finalize pass 1 - stage: build pass a
os: linux os: linux
dist: trusty dist: trusty
sudo: required sudo: required
env: IMAGE="opm-${TRAVIS_TAG}.img"
addons: addons:
apt: apt:
packages: packages:
@ -52,14 +52,13 @@ jobs:
- aws s3 sync "s3://${AWS_BUCKET}" "${AWS_SHARED}" - aws s3 sync "s3://${AWS_BUCKET}" "${AWS_SHARED}"
- aws s3 rm "s3://${AWS_BUCKET}" --recursive - aws s3 rm "s3://${AWS_BUCKET}" --recursive
- mv "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}.zip" - mv "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}.zip"
- sudo bash ./scripts/ci/rpi/finalize.sh - sudo bash ./scripts/ci/rpi/buid.sh
- zip "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}" - zip "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}"
- aws s3 sync "${AWS_SHARED}" "s3://${AWS_BUCKET}" - aws s3 sync "${AWS_SHARED}" "s3://${AWS_BUCKET}"
- stage: finalize pass 2 - stage: build pass b
os: linux os: linux
dist: trusty dist: trusty
sudo: required sudo: required
env: IMAGE="opm-${TRAVIS_TAG}.img"
addons: addons:
apt: apt:
packages: packages:
@ -74,7 +73,7 @@ jobs:
- aws s3 sync "s3://${AWS_BUCKET}" "${AWS_SHARED}" - aws s3 sync "s3://${AWS_BUCKET}" "${AWS_SHARED}"
- aws s3 rm "s3://${AWS_BUCKET}" --recursive - aws s3 rm "s3://${AWS_BUCKET}" --recursive
- mv "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}.zip" - mv "${AWS_SHARED}/${IMAGE}.zip" "./${IMAGE}.zip"
- sudo bash ./scripts/ci/rpi/finalize.sh - sudo bash ./scripts/ci/rpi/build.sh
- zip "${IMAGE}.zip" "./${IMAGE}" - zip "${IMAGE}.zip" "./${IMAGE}"
deploy: deploy:
provider: releases provider: releases

8
scripts/ci/rpi/build-script.sh

@ -0,0 +1,8 @@
#!/bin/bash
echo "Begin build-script.sh"
cd /home/pi/openFrameworks/addons/ofxPiMapper/example_basic
timeout 30m make -j $(nproc)
echo "End build-script.sh"

2
scripts/ci/rpi/finalize.sh → scripts/ci/rpi/build.sh

@ -14,7 +14,7 @@ fi
# Image creation constants. # Image creation constants.
# See .travis.yml for environment variables. # See .travis.yml for environment variables.
MOUNT="mnt" MOUNT="mnt"
SCRIPT="finalize-script.sh" SCRIPT="build-script.sh"
# Unmount drives and general cleanup on exit, the trap ensures this will always # Unmount drives and general cleanup on exit, the trap ensures this will always
# run execpt in the most extream cases. # run execpt in the most extream cases.

8
scripts/ci/rpi/finalize-script.sh

@ -1,8 +0,0 @@
#!/bin/bash
echo "Finalizing OPM RPi image."
cd /home/pi/openFrameworks/addons/ofxPiMapper/example_basic
timeout 25m make -j $(nproc)
echo "OPM RPi image setup done!"

12
scripts/ci/rpi/addons-script.sh → scripts/ci/rpi/prepare-script.sh

@ -1,14 +1,8 @@
#!/bin/bash #!/bin/bash
echo "Compiling addons." echo "Begin prepare-script.sh"
cd /home/pi/openFrameworks/addons/ofxOMXPlayer/example-basic echo "Installing extra packages."
make -j $(nproc)
cd /home/pi/openFrameworks/addons/ofxJSON/example_file_read_write
make -j $(nproc)
echo "Inastalling extra packages."
sudo apt-get -yq install usbmount dosfstools exfat-fuse exfat-utils sudo apt-get -yq install usbmount dosfstools exfat-fuse exfat-utils
echo "Setting hostname." echo "Setting hostname."
@ -21,4 +15,4 @@ echo "@reboot /home/pi/openFrameworks/addons/ofxPiMapper/example_basic/bin/examp
crontab mycron crontab mycron
rm mycron rm mycron
echo "Compiling addons done!" echo "End prepare-script.sh"

2
scripts/ci/rpi/addons.sh → scripts/ci/rpi/prepare.sh

@ -14,7 +14,7 @@ fi
# Image creation constants. # Image creation constants.
# See .travis.yml for environment variables. # See .travis.yml for environment variables.
MOUNT="mnt" MOUNT="mnt"
SCRIPT="addons-script.sh" SCRIPT="prepare-script.sh"
# Unmount drives and general cleanup on exit, the trap ensures this will always # Unmount drives and general cleanup on exit, the trap ensures this will always
# run execpt in the most extream cases. # run execpt in the most extream cases.
Loading…
Cancel
Save