diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c23822d32135fb4727715c2289be854ef6c2bf0..77022b0a789a0f068680555e082018a8fd40b728 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,41 @@ -pages: - image: julia:1.4 - stage: deploy +.test_template: &test_definition + # Uncomment below if you would like to run the tests on specific references + # only, such as the branches `master`, `development`, etc. + # only: + # - master + # - development script: - - apt-get update -qq && apt-get install -y git # needed by Documenter - - julia -e 'using Pkg; Pkg.add(PackageSpec(path =pwd())); Pkg.build("ABMEv");' # rebuild Julia (can be put somewhere else I'm sure - - julia -e 'using Pkg; import ABMEv; Pkg.add("Documenter")' # install Documenter - - julia --color=yes docs/make.jl # make documentation - - mv docs/build public # move to the directory picked up by Gitlab pages - artifacts: - paths: - - public - only: - - master + # Let's run the tests. Substitute `coverage = false` below, if you do not + # want coverage results. + - julia -e 'using Pkg; Pkg.add(PackageSpec(path =pwd())); Pkg.build("ABMEv"); Pkg.test("ABMEv"; coverage = true)' + # Comment out below if you do not want coverage results. + - julia -e 'using Pkg; Pkg.add("Coverage"); + import ABMEv; cd(joinpath(dirname(pathof(ABMEv)), "..")); + using Coverage; cl, tl = get_summary(process_folder()); + println("(", cl/tl*100, "%) covered")' + +# Name a test and select an appropriate image. +# images comes from Docker hub +test:0.7: + image: julia:0.7 + <<: *test_definition + +test:1.0: + image: julia:1.0 + <<: *test_definition + +## Below commented because gitlab.ethz.ch has disabled Pages feature +# pages: +# image: julia:1.4 +# stage: deploy +# script: +# - apt-get update -qq && apt-get install -y git # needed by Documenter +# - julia -e 'using Pkg; Pkg.add(PackageSpec(path =pwd())); Pkg.build("ABMEv");' # rebuild Julia (can be put somewhere else I'm sure +# - julia -e 'using Pkg; import ABMEv; Pkg.add("Documenter")' # install Documenter +# - julia --color=yes docs/make.jl # make documentation +# - mv docs/build public # move to the directory picked up by Gitlab pages +# artifacts: +# paths: +# - public +# only: +# - master