From 01cf8345a0ace0624fece387388971922653259a Mon Sep 17 00:00:00 2001 From: servostar Date: Thu, 2 May 2024 12:14:59 +0200 Subject: [PATCH] reverted change of #aa7c62f0 in devkit added script to run checks and tests in container --- .github/workflows/build-check-sdk.yaml | 4 +-- Dockerfile | 9 ++++-- run-check-test.sh | 40 ++++++++++++++++++++++++++ sdk/Dockerfile | 4 +-- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 run-check-test.sh diff --git a/.github/workflows/build-check-sdk.yaml b/.github/workflows/build-check-sdk.yaml index 5b8f2aa..10a4811 100644 --- a/.github/workflows/build-check-sdk.yaml +++ b/.github/workflows/build-check-sdk.yaml @@ -2,7 +2,7 @@ name: "Build check gemstone in SDK" run-name: SDK build check to ${{ inputs.deploy_target }} by @${{ github.actor }} on: [push, pull_request] env: - SDK: 0.2.1-alpine-3.19.1 + SDK: 0.2.2-alpine-3.19.1 jobs: build-check-sdk: runs-on: ubuntu-latest @@ -11,4 +11,4 @@ jobs: - name: Setup SDK run: docker pull servostar/gemstone:sdk-"$SDK" && docker build --tag gemstone:devkit-"$SDK" . - name: Compile - run: docker run gemstone:devkit-"$SDK" make check + run: docker run gemstone:devkit-"$SDK" sh run-check-test.sh diff --git a/Dockerfile b/Dockerfile index ce2db20..09e34b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,12 @@ -FROM servostar/gemstone:sdk-0.2.1-alpine-3.19.1 +FROM servostar/gemstone:sdk-0.2.2-alpine-3.19.1 LABEL authors="servostar" -LABEL version="0.2.1" +LABEL version="0.2.2" LABEL description="docker image for setting up the build pipeline on SDK" LABEL website="https://github.com/Servostar/gemstone" -RUN git clone https://github.com/Servostar/gemstone.git /home/lorang +COPY --chown=lorang src /home/lorang/src +COPY --chown=lorang tests /home/lorang/tests +COPY --chown=lorang CMakeLists.txt /home/lorang/ +COPY --chown=lorang run-check-test.sh /home/lorang/ RUN cmake . diff --git a/run-check-test.sh b/run-check-test.sh new file mode 100644 index 0000000..a2a3ab4 --- /dev/null +++ b/run-check-test.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env sh + +# Author: Sven Vogel +# Created: 02.05.2024 +# Description: Builds the project and runs tests +# Returns 0 on success and 1 when something went wrong + +echo "+--------------------------------------+" +echo "| BUILDING all TARGETS |" +echo "+--------------------------------------+" + +make -B +if [ ! $? -eq 0 ]; then + echo "===> failed to build targets" + exit 1 +fi + +echo "+--------------------------------------+" +echo "| RUNNING CODE CHECK |" +echo "+--------------------------------------+" + +make check +if [ ! $? -eq 0 ]; then + echo "===> failed code check..." + exit 1 +fi + +echo "+--------------------------------------+" +echo "| RUNNING TESTS |" +echo "+--------------------------------------+" + +ctest -VV --output-on-failure --schedule-random -j 4 +if [ ! $? -eq 0 ]; then + echo "===> failed tests..." + exit 1 +fi + +echo "+--------------------------------------+" +echo "| COMPLETED CHECK + TESTS SUCCESSFULLY |" +echo "+--------------------------------------+" \ No newline at end of file diff --git a/sdk/Dockerfile b/sdk/Dockerfile index 4dbeb1f..1a6a677 100644 --- a/sdk/Dockerfile +++ b/sdk/Dockerfile @@ -1,11 +1,11 @@ FROM alpine:3.19.1 LABEL authors="servostar" -LABEL version="0.2.1" +LABEL version="0.2.2" LABEL description="base image for building the gemstone programming language compiler" LABEL website="https://github.com/Servostar/gemstone" # install dependencies -RUN apk add build-base gcc make cmake bison flex git +RUN apk add build-base gcc make cmake bison flex git python3 # create user for build RUN adduser --disabled-password lorang