From bc338a9c6f8c8e35de5705cf5692b962b96a1443 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Wed, 30 Jun 2021 12:55:44 +0200 Subject: [PATCH] TST: Add style check to pipeline --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ docs/make.jl | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 899bdba..bf17c70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,9 +17,31 @@ variables: CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-julialib/testenv:latest stages: + - code-style - test - deploy +# Only check style for Julia 1.6 since support for 1.0 may be dropped anyway +code-style: + image: julia:1.6 + tags: [ docker ] + script: + # 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 !!!" + write(stdout, out) + exit(1) + end' + + # Name a test and select an appropriate image. # images comes from Docker hub test:1.0: diff --git a/docs/make.jl b/docs/make.jl index bfd6289..836b38b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,3 +1,5 @@ using Documenter, CaosDB -makedocs(modules = [CaosDB], sitename = "CaosDB.jl Documentation") +makedocs( + modules=[CaosDB], + sitename="CaosDB.jl Documentation") -- GitLab