initial attempt at CI build

This commit is contained in:
Jeff Wang 2020-09-14 01:07:42 -04:00 committed by Jeff Wang
parent 233f347ecc
commit bef903b20a
11 changed files with 116 additions and 0 deletions

1
.github/actions/stc_docker/Dockerfile vendored Symbolic link
View File

@ -0,0 +1 @@
../../../Dockerfile

1
.github/actions/stc_docker/action.yml vendored Symbolic link
View File

@ -0,0 +1 @@
../../../action.yml

17
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,17 @@
on: [push]
jobs:
stc_rpncalc_ci_job:
runs-on: ubuntu-latest
name: Test building
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker layer cache
uses: satackey/action-docker-layer-caching@v0.0.8
- name: Docker
run: $GITHUB_WORKSPACE/steps/compose_build.sh
- name: Desktop build/check
run: $GITHUB_WORKSPACE/steps/compose_run.sh desktop_build_check.sh --rebuild
- name: Calc build
run: $GITHUB_WORKSPACE/steps/compose_run.sh build_calc.sh

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp
*.hex
*.bak
CMakeLists.txt.user

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM ubuntu:18.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
catch \
clang \
cmake \
git \
lcov \
libboost-dev \
libgmp-dev \
libmpfr-dev \
ninja-build \
qtdeclarative5-dev \
sdcc=3.5.0+dfsg-2build1 \
vim-tiny

7
action.yml Normal file
View File

@ -0,0 +1,7 @@
# GitHub Actions
name: 'STC RPN Calc CI build'
description: 'run CI build in docker container'
runs:
using: 'docker'
image: 'Dockerfile'

9
steps/build_calc.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# build
cd $SCRIPT_DIR/..
make

9
steps/compose_build.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# build
cd $SCRIPT_DIR
docker-compose build

21
steps/compose_run.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# set GITHUBWORKSPACE if building locally
if [[ -z "${GITHUB_WORKSPACE}" ]]; then
export GITHUB_WORKSPACE="$SCRIPT_DIR/.."
fi
echo "GITHUB_WORKSPACE: ${GITHUB_WORKSPACE}"
# build
cd $SCRIPT_DIR
if [ "$#" -eq 0 ]; then
# start shell
docker-compose run build_tools bash
else
docker-compose run build_tools /code/steps/$1
fi

24
steps/desktop_build_check.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# build
cd $SCRIPT_DIR/..
if [ "$1" == "--rebuild" ]; then
rm -rf build_qt
mkdir build_qt
else
mkdir -p build_qt
fi
cd build_qt
cmake .. -GNinja
ninja
# run tests
src/decn/decn_tests
# get coverage
lcov --capture --directory src/decn --output-file coverage.info
genhtml coverage.info --output-directory lcov

10
steps/docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
version: '3.2'
services:
build_tools:
build:
context: ..
dockerfile: Dockerfile
volumes:
- type: bind
source: $GITHUB_WORKSPACE
target: /code