diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8fee397 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,160 @@ +stages: + - build + - deploy + +before_script: + +win32_build: + stage: build + tags: + - win32 + script: + - 'set path=%path%;C:\Programme\VS6\Common\MSDev98\Bin' + - mkdir out-win32 + - set + - call ci\build-win32.bat + - if not exist out-win32/bcm32.exe exit 1 + artifacts: + paths: + - out-win32/*.exe + expire_in: 2 week + +dos_build: + stage: build + tags: + - win32 + script: + - 'set path=%path%;c:\borlandc\bin' + - call gitversion.bat + - mkdir out-dos + - set + - call ci\build-dos.bat + - if not exist out-dos/bcm.exe exit 1 + artifacts: + paths: + - OUT-DOS/*.EXE + expire_in: 2 week + +linux_x86-32_build: + stage: build + image: hpm/ubuntu:xenial-16.04-32 + tags: + - linux + script: + - OUT=out-x86_32/ make + artifacts: + paths: + - out-x86_32/bcm + expire_in: 2 week + +linux_x86-64_build: + stage: build + image: hpm/ubuntu:xenial-16.04-64 + tags: + - linux + before_script: + - apt-get update + - apt-get -y install g++-multilib gcc-multilib + script: + - OUT=out-x86_64/ make + artifacts: + paths: + - out-x86_64/bcm + expire_in: 2 week + +linux_armv7_build: + stage: build + image: hpm/ubuntu:xenial-16.04-64 + tags: + - linux + script: + - OUT=out-armv7hf/ CROSS_COMPILE=/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- PLATTFORM=armv7hf make + artifacts: + paths: + - out-armv7hf/bcm + expire_in: 2 week + +linux_armv6_build: + stage: build + image: hpm/ubuntu:xenial-16.04-32 + tags: + - linux + script: + - OUT=out-armv6/ CROSS_COMPILE=/opt/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- PLATTFORM=armv6 make + artifacts: + paths: + - out-armv6/bcm + expire_in: 2 week + +deploy-github-release: + stage: deploy + image: hpm/ubuntu:xenial-16.04-64 + variables: + GIT_STRATEGY: clone + tags: + - linux + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - mkdir -p ~/.ssh + - eval $(ssh-agent -s) + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + - ssh-add <(echo "$GITHUB_PRIVATE_KEY") + script: + - git remote add github git@github.com:oe5hpm/openBCM.git + - git push github --tags + - ci/deploy-release.sh + environment: + name: openbcm.hamspirit.at {production} + url: https://github.com/oe5hpm/openBCM + only: + - tags + when: manual + +deploy-github: + stage: deploy + image: hpm/ubuntu:xenial-16.04-64 + dependencies: [] + variables: + GIT_STRATEGY: clone + tags: + - linux + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - mkdir -p ~/.ssh + - eval $(ssh-agent -s) + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + - ssh-add <(echo "$GITHUB_PRIVATE_KEY") + script: + - git remote add github git@github.com:oe5hpm/openBCM.git + - git push github HEAD:refs/heads/$CI_COMMIT_REF_NAME + environment: + name: openbcm.hamspirit.at {production} + url: https://github.com/oe5hpm/openBCM + on_stop: stop_git-branch + when: manual + +stop_git-branch: + stage: deploy + image: hpm/ubuntu:xenial-16.04-64 + dependencies: [] + variables: + GIT_STRATEGY: clone + tags: + - linux + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - mkdir -p ~/.ssh + - eval $(ssh-agent -s) + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + - ssh-add <(echo "$GITHUB_PRIVATE_KEY") + script: + - git remote add github git@github.com:oe5hpm/openBCM.git + - git push github --delete $CI_COMMIT_REF_NAME + when: manual + except: + - master + environment: + name: openbcm.hamspirit.at {production} + url: https://github.com/oe5hpm/openBCM + action: stop + diff --git a/ci/build-dos.bat b/ci/build-dos.bat new file mode 100644 index 0000000..7681fea --- /dev/null +++ b/ci/build-dos.bat @@ -0,0 +1,18 @@ +@echo off + +REM we always must return error code 0, since gitlab runner isn't able +REM today detecting a failure of a command. +REM we check afterwards within the job script for an existing build-output +REM and decide failing or not. + +bcpp /m bcm.prj +if %errorlevel% == 0 goto success + +:fail +echo "build failed!" +exit /b 0 + +:success +echo "build succeed!" +exit /b 0 + diff --git a/ci/build-win32.bat b/ci/build-win32.bat new file mode 100644 index 0000000..d5f540c --- /dev/null +++ b/ci/build-win32.bat @@ -0,0 +1,17 @@ +@echo off + +REM we always must return error code 0, since gitlab runner isn't able +REM today detecting a failure of a command. +REM we check afterwards within the job script for an existing build-output +REM and decide failing or not. + +msdev bcm32.dsw /make "bcm32 - Win32 Release" /clean /rebuild +if %errorlevel% == 0 goto success + +:fail +echo "build failed!" +exit /b 0 + +:success +echo "build succeed!" +exit /b 0 diff --git a/ci/deploy-release.sh b/ci/deploy-release.sh new file mode 100755 index 0000000..b5baec3 --- /dev/null +++ b/ci/deploy-release.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +ARCHLIST=`ls | grep -i out-` + +mkdir -p out +for i in $ARCHLIST; do + echo prepare $i ... + if echo $i | grep -c win32 >/dev/null; then cp $i/* out/; continue; fi + if echo $i | grep -c DOS >/dev/null; then cp $i/* out/; continue; fi + ARCH=`echo $i | cut -f 2 -d '-'` + cp $i/bcm out/bcm-$ARCH +done + +ci/ghr -t $GITHUB_TOKEN -u oe5hpm -r openBCM $CI_COMMIT_REF_NAME out + diff --git a/ci/ghr b/ci/ghr new file mode 100755 index 0000000..f9853b6 Binary files /dev/null and b/ci/ghr differ diff --git a/gitversion.bat b/gitversion.bat index 1cb6a29..5d17311 100644 --- a/gitversion.bat +++ b/gitversion.bat @@ -8,3 +8,5 @@ echo #define GITVERSION ^"%VAR%^" > gitver.h copy bcm32.rc.template bcm32.rc /y ext\_sed -i "s/_productversion_/%VAR%/g" bcm32.rc del sed* /f + +exit /b 0