Skip to content

Commit

Permalink
Merge pull request epics-modules#55 from ralphlange/devel/gitlab
Browse files Browse the repository at this point in the history
Support for GitLab CI/CD
(closes epics-modules#51)
  • Loading branch information
ralphlange committed Sep 14, 2020
2 parents 3c1cf15 + 984fa5e commit 12a0656
Show file tree
Hide file tree
Showing 7 changed files with 448 additions and 28 deletions.
160 changes: 160 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# .gitlab-ci.yml for testing EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)

# Note:
# Paths to scripts are different in this test configuration
# (your module has one more directory level: .ci)

image: ubuntu:bionic

cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- .cache/

variables:
GIT_SUBMODULE_STRATEGY: "recursive"
SETUP_PATH: ".:.ci"
BASE_RECURSIVE: "NO"
APT: "libreadline6-dev libncurses5-dev perl clang g++-mingw-w64-i686 g++-mingw-w64-x86-64 qemu-system-x86 re2c"
CMP: "gcc"
BGFC: "default"
VV: "1"
SET: test01

# Unit tests
unit_test:
stage: build
variables:
SET: test00
before_script:
- apt-get update -qq && apt-get install -y -qq make git python curl p7zip-full
- python cue-test.py env
script:
- python cue-test.py

# Template job for test builds (hidden)
.build:
stage: build
before_script:
- apt-get update -qq && apt-get install -y -qq build-essential git python curl p7zip-full
- python cue.py prepare
script:
- python cue.py build
- python cue.py test
- python cue.py test-results

# gcc builds using four configurations (shared/static, optimized/debug)
gcc_default:
extends: .build

gcc_static:
extends: .build
variables:
BCFG: "static"

gcc_debug:
extends: .build
variables:
BCFG: "debug"

gcc_static_debug:
extends: .build
variables:
BCFG: "static-debug"

# clang builds using four configurations (shared/static, optimized/debug)
clang_default:
extends: .build
variables:
CMP: "clang"

clang_static:
extends: .build
variables:
CMP: "clang"
BCFG: "static"

clang_debug:
extends: .build
variables:
CMP: "clang"
BCFG: "debug"

clang_static_debug:
extends: .build
variables:
CMP: "clang"
BCFG: "static-debug"

# WINE based cross-builds to Windows 32bit and 64bit
wine32_default:
extends: .build
variables:
WINE: "32"

wine32_static:
extends: .build
variables:
WINE: "32"
BCFG: "static"

wine32_debug:
extends: .build
variables:
WINE: "32"
BCFG: "debug"

wine32_static_debug:
extends: .build
variables:
WINE: "32"
BCFG: "static-debug"

wine64_default:
extends: .build
variables:
WINE: "64"

wine64_static:
extends: .build
variables:
WINE: "64"
BCFG: "static"

wine64_debug:
extends: .build
variables:
WINE: "64"
BCFG: "debug"

wine64_static_debug:
extends: .build
variables:
WINE: "64"
BCFG: "static-debug"

# Cross-builds to RTEMS 4.9 and 4.10
rtems4.9_default:
extends: .build
variables:
RTEMS: "4.9"
BASE: "3.15"

rtems4.9_debug:
extends: .build
variables:
RTEMS: "4.9"
BASE: "3.15"
BCFG: "debug"

rtems4.10_default:
extends: .build
variables:
RTEMS: "4.10"

rtems4.10_debug:
extends: .build
variables:
RTEMS: "4.10"
BCFG: "debug"
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ See specific
**[ci-scripts on GitHub Actions README](github-actions/README.md)**
for more details.

### [GitLab CI/CD](https://gitlab.com/)

- Docker-based runners on Linux (one VM instance per job)
- Can use any Docker image from Dockerhub (the examples use
`ubuntu:bionic`)
- Compile natively using different compilers (gcc, clang)
- Cross-compile for Windows 32bit and 64bit using MinGW and WINE
- Cross-compile for RTEMS 4.9 and 4.10 (Base >= 3.15)
- Built dependencies are cached (for faster builds).

See specific
**[ci-scripts on GitLab CI/CD README](gitlab/README.md)**
for more details.

## How to Use the CI-Scripts

1. Get an account on a supported CI service provider platform
Expand Down
36 changes: 24 additions & 12 deletions cue-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
ci_service = 'travis'
ci_os = os.environ['TRAVIS_OS_NAME']

if 'GITLAB_CI' in os.environ:
ci_service = 'gitlab'
ci_os = 'linux'

if 'APPVEYOR' in os.environ:
ci_service = 'appveyor'
if re.match(r'^Visual', os.environ['APPVEYOR_BUILD_WORKER_IMAGE']):
Expand Down Expand Up @@ -118,7 +122,7 @@ def test_DoubleIncludeGetsIgnored(self):


class TestUpdateReleaseLocal(unittest.TestCase):
release_local = os.path.join(cue.cachedir, 'RELEASE.local')
release_local = os.path.join(cue.ci['cachedir'], 'RELEASE.local')

def setUp(self):
if os.path.exists(self.release_local):
Expand Down Expand Up @@ -186,16 +190,21 @@ def test_SetBaseAndMultipleModules(self):

class TestAddDependencyUpToDateCheck(unittest.TestCase):
hash_3_15_6 = "ce7943fb44beb22b453ddcc0bda5398fadf72096"
location = os.path.join(cue.cachedir, 'base-R3.15.6')
licensefile = os.path.join(location, 'LICENSE')
checked_file = os.path.join(location, 'checked_out')
release_file = os.path.join(location, 'configure', 'RELEASE')
location = ''
licensefile = ''
checked_file = ''
release_file = ''

def setUp(self):
os.environ['SETUP_PATH'] = '.:appveyor'
cue.clear_lists()
cue.detect_context()
self.location = os.path.join(cue.ci['cachedir'], 'base-R3.15.6')
self.licensefile = os.path.join(self.location, 'LICENSE')
self.checked_file = os.path.join(self.location, 'checked_out')
self.release_file = os.path.join(self.location, 'configure', 'RELEASE')
if os.path.exists(self.location):
shutil.rmtree(self.location, onerror=cue.remove_readonly)
cue.clear_lists()
os.chdir(builddir)
cue.source_set('defaults')
cue.complete_setup('BASE')
Expand Down Expand Up @@ -249,15 +258,18 @@ def is_shallow_repo(place):


class TestAddDependencyOptions(unittest.TestCase):
location = os.path.join(cue.cachedir, 'mcoreutils-master')
testfile = os.path.join(location, '.ci', 'LICENSE')
location = ''
testfile = ''

def setUp(self):
os.environ['SETUP_PATH'] = '.'
if os.path.exists(cue.cachedir):
shutil.rmtree(cue.cachedir, onerror=cue.remove_readonly)
cue.clear_lists()
cue.detect_context()
if os.path.exists(cue.ci['cachedir']):
shutil.rmtree(cue.ci['cachedir'], onerror=cue.remove_readonly)
self.location = os.path.join(cue.ci['cachedir'], 'mcoreutils-master')
self.testfile = os.path.join(self.location, '.ci', 'LICENSE')
os.path.join(cue.ci['cachedir'], 'mcoreutils-master')
cue.source_set('defaults')
cue.complete_setup('MCoreUtils')
cue.setup['MCoreUtils'] = 'master'
Expand Down Expand Up @@ -288,7 +300,7 @@ def test_SetDepthThree(self):
def test_AddMsiTo314(self):
cue.complete_setup('BASE')
cue.setup['BASE'] = 'R3.14.12.1'
msifile = os.path.join(cue.cachedir, 'base-R3.14.12.1', 'src', 'dbtools', 'msi.c')
msifile = os.path.join(cue.ci['cachedir'], 'base-R3.14.12.1', 'src', 'dbtools', 'msi.c')
cue.add_dependency('BASE')
self.assertTrue(os.path.exists(msifile), 'MSI was not added to Base 3.14')

Expand Down Expand Up @@ -834,7 +846,7 @@ def test_ExtraMakeArgs(self):


class TestHooks(unittest.TestCase):
location = os.path.join(cue.cachedir, 'hook_test')
location = os.path.join(cue.ci['cachedir'], 'hook_test')
bla_file = os.path.join(location, 'bla.txt')
new_file = os.path.join(location, 'dd', 'new.txt')

Expand Down
Loading

0 comments on commit 12a0656

Please sign in to comment.