Merge pull request #528 from Ralim/ci-codeship

Setting up CI builds
This commit is contained in:
Ben V. Brown
2019-12-23 19:26:29 +11:00
committed by GitHub
13 changed files with 4866 additions and 4769 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Ignore all differences in line endings
* -crlf

4
.gitignore vendored
View File

@@ -61,3 +61,7 @@ workspace/TS100/Hexfile/
workspace/RemoteSystemsTempFiles/
workspace/TS100/.settings/
workspace/TS100/TS80/
ci/artefacts/
ci/secrets/unencrypted/
codeship.aes
.vscode/settings.json

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM ubuntu:rolling
MAINTAINER Ben V. Brown <ralim@ralimtek.com>
WORKDIR /build
# Setup the ARM GCC toolchain
# Install any needed packages specified in requirements.txt
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
make \
git \
bzip2 \
git \
golang \
python3 \
wget && \
apt-get clean && \
wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 | tar -xj
# Add compiler to the path
ENV PATH "/build/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH"
# Get the github release tool
RUN go get -u github.com/aktau/github-release
COPY . /build/source
COPY ./ci /build/ci

View File

@@ -192,7 +192,7 @@ def getLetterCounts(defs, lang):
symbolCounts[letter] = symbolCounts.get(letter, 0) + 1
symbolCounts = sorted(
symbolCounts.items(),
key=lambda kv: kv[1]) # swap to Big -> little sort order
key=lambda kv: (kv[1],kv[0])) # swap to Big -> little sort order
symbolCounts = list(map(lambda x: x[0], symbolCounts))
symbolCounts.reverse()
return symbolCounts

13
ci/buildAll.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
set -u
mkdir -p /build/ci/artefacts
# Build STM code
cd /build/source/workspace/TS100/
bash ./build.sh || exit 1
echo "All Firmware built"
# Copy out all the final resulting files we would like to store for the next op
cp -r /build/source/workspace/TS100/Hexfile/*.hex /build/ci/artefacts/
cp -r /build/source/workspace/TS100/Hexfile/*.bin /build/ci/artefacts/

16
ci/secrets/decrypt.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SECRETS="$DIR/encrypted/*.encrypted"
KEY="$DIR/../../codeship.aes"
mkdir -p $DIR/unencrypted
for f in $SECRETS
do
out="${f/.encrypted/.secret}"
out="${out/encrypted/unencrypted}"
echo $out
jet decrypt $f $out --key-path $KEY
done
echo "Done"

View File

@@ -0,0 +1,2 @@
codeship:v2
DUgOERb8iPVn95/DKIw9M7sgNjJlIlsaeE4PFV58tmmBu2sD1ooR7Y0L23bimC9a

8
codeship-services.yml Normal file
View File

@@ -0,0 +1,8 @@
builder:
build:
context: .
dockerfile: Dockerfile
cached: true
encrypted_env_file: ci/secrets/encrypted/deployment.encrypted
volumes:
- ./ci:/ci

11
codeship-steps.yml Normal file
View File

@@ -0,0 +1,11 @@
- type: parallel
name: Build the firmware
steps:
- name: build
service: builder
command: /build/ci/buildAll.sh
- name: deploy
service: builder
command: /ci/deployRelease.sh
tag: master

11
docker-compose.yml Normal file
View File

@@ -0,0 +1,11 @@
version: '3'
services:
builder:
stdin_open: true
tty: true
build:
context: .
command: /bin/bash
volumes:
- ./ci:/build/ci
- ./:/build/source

2
start_dev.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
docker-compose run --rm builder

File diff suppressed because it is too large Load Diff

View File

@@ -145,7 +145,8 @@ then
echo "Building firmware for $model in $lang"
make -j lang="$lang" model="$model" >/dev/null
checkLastCommand
rm -rf Objects/src>/dev/null
rm -rf Objects >/dev/null
checkLastCommand
done
done
else