Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 6.08 KiB
# Taken an adapted from gitlab's example repos:
# https://gitlab.com/gitlab-examples/julia

# An example .gitlab-ci.yml file to test (and optionally report the
# coverage results of) your [Julia][1] packages. Please refer to the
# [documentation][2] for more information about package development in
# Julia.
#
# Here, it is assumed that your Julia package is named
# `MyPackage`. Change it to whatever name you have given to your
# package.
#
# [1]: http://julialang.org/
# [2]: https://docs.julialang.org/en/v1/manual/documentation/index.html

variables:
  JULIALIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-julialib/testenv:$CI_COMMIT_REF_NAME

  JULIAINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/120/trigger/pipeline
  JULIAINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/120/repository/branches
  GIT_SUBMODULE_STRATEGY: normal

  TRIGGERED_BY_REPO: JULIALIB
  TRIGGERED_BY_REF: $CI_COMMIT_REF_NAME
  TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA

  # The defalt branch to use with caosdb-cpplib
  CPP_DEFAULT_BRANCH: dev

image: $JULIALIB_REGISTRY_IMAGE

stages:
  - info
  - code-style
  - setup
  - test
  - deploy

# Print debugging info
info:
  tags: [cached-dind]
  image: docker:20.10
  stage: info
  needs: []
  script:
    - echo "Pipeline triggered by $TRIGGERED_BY_REPO@$TRIGGERED_BY_REF ($TRIGGERED_BY_HASH)"
    - echo "$JULIALIB_REGISTRY_IMAGE"
    - echo "$JULIAINTTEST_PIPELINE"
    - echo "$JULIAINTTEST_BRANCHES"
    - echo "$GIT_SUBMODULE_STRATEGY"

# Only check style for Julia 1.6 since support for 1.0 may be dropped anyway
code-style:
  stage: code-style
  image: julia:1.6
  tags: [ docker ]
  script:
    # install git
    - apt-get update && apt-get install -y git
    # install JuliaFormatter
    - julia  -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
    # try and format the files
    - julia  -e 'using JuliaFormatter; format(".", verbose=true)'
    # check the git diff for possible changes due to the formatting
    - julia -e '
      out = Cmd(`git diff --name-only`) |> read |> String;
      if out == ""
          exit(0);
      else
          @error "Some files have not been formatted !!!";