Merge branch 'jjj11x/ci'

This commit is contained in:
Jeff Wang 2020-09-14 10:05:03 -04:00
commit 0a552c9f61
11 changed files with 131 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

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

@ -0,0 +1,29 @@
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
- name: ls
run: ls $GITHUB_WORKSPACE
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stc_rpncalc_artifacts
path: |
${{ github.workspace }}/build/
${{ github.workspace }}/build_qt/lcov/
${{ github.workspace }}/build_qt/decn.c.gcov
${{ github.workspace }}/main.hex
if-no-files-found: error

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

27
steps/desktop_build_check.sh Executable file
View File

@ -0,0 +1,27 @@
#!/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
echo "Running lcov"
lcov --capture --directory src/decn --output-file coverage.info
genhtml coverage.info --output-directory lcov
echo "Running gcov"
gcov -b src/decn/CMakeFiles/decn_cover.dir/decn.c.gcno

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