Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.67 KiB
image: git.fortiss.org:5001/af3/maven-releng:latest

stages:
  - clean
  - build
  - test
  - deploy

variables:
  # recursive should work here, but gitlab-runner does not pull the latest remote
  # for submodules: https://gitlab.com/gitlab-org/gitlab-runner/issues/3011
  GIT_SUBMODULE_STRATEGY: none
  GIT_SUBMODULE_OPTS: "--remote --recursive --init --recommend-shallow --force"
  MAVEN_CLI_OPTS: "--batch-mode"
  MAVEN_OPTS: "-Dmaven.repo.local=/cache/maven.repository"
  MAVEN_BUILD_OPTS: "-Dbuild.tooling=true -Dbuild.af3=true -Dbuild.emf=true"
  MAVEN_TEST_OPTS: "-Dbuild.tests=true"
  MAVEN_BUILD_DIR: "-Duser.dir=/builds/$CI_PROJECT_PATH"

clean:
  stage: clean
  cache:
    key: Default
  rules:
    - if: '$BUILD_TYPE == "clean"' # This rule will be evaluated
      when: on_success
  before_script:
    - git submodule update $GIT_SUBMODULE_OPTS
    - git submodule foreach 'git pull --no-rebase origin $BUILD_BRANCH || true'
  script:
    - mvn $MAVEN_CLI_OPTS $MAVEN_BUILD_OPTS clean

build:
  stage: build
  cache:
    key: Default
  before_script:
    - git submodule update $GIT_SUBMODULE_OPTS
    - git submodule foreach 'git pull --no-rebase origin $BUILD_BRANCH || true'
  script:
    - mvn $MAVEN_CLI_OPTS $MAVEN_BUILD_OPTS verify
  artifacts:
    untracked: true
    paths:
      - releng/org.fortiss.af3.update/target/repository/
      - releng/org.fortiss.tooling.update/target/repository/
      - products/af3/org.fortiss.af3.phoenix.product/target/products/org.fortiss.af3.phoenix.product-*.zip

test:
  stage: test
  dependencies: 
    - build
  cache:
    key: Default
  before_script:
    - git submodule update $GIT_SUBMODULE_OPTS
    - git submodule foreach 'git pull --no-rebase origin $BUILD_BRANCH || true'
    - xvfb.sh # Setup of a virtual display needed for bringing up eclipse
  script:
    - mvn $MAVEN_CLI_OPTS $MAVEN_TEST_OPTS $MAVEN_BUILD_DIR integration-test
  artifacts:
    paths:
      - tests/af3/org.fortiss.af3.phoenix.product.tests/target/surefire-reports/TEST-org.fortiss.af3.phoenix.product.tests.AllTests.xml
      - products/af3/org.fortiss.af3.phoenix.product/target/products/org.fortiss.af3.phoenix.product-*.zip

deploy:
  stage: deploy
  dependencies:
    - test
  rules: