Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.6 KiB
Newer Older
stages:
  - test

tests:
  stage: test
  image: ocaml/opam@sha256:013a26ccbaa8344b63274e335e2492c432cec1c3526b9ba888ab151abb2b4c25
  cache:
    key: $CI_COMMIT_REF_SLUG
    paths:
      - _opam
  script:
    - if [ ! -d _opam ]; then echo "no local switch in the CI cache, we setup a new switch"; opam switch create --yes --no-install . ocaml-base-compiler.4.13.1; fi
    - opam switch 4.13
    - eval $(opam env --switch=4.13 --set-switch)
    - opam switch
    - sudo apt-get update
    - sudo apt install -y protobuf-compiler
    - opam repository add remote https://opam.ocaml.org
    - opam depext --yes ocplib-endian base fmt alt-ergo.2.4.0
    - opam install . --deps-only --with-test --yes
    - make
    - make test
  tags:
    - docker


################################################################################
### PUBLIC

# make_public stage is used to push the current master branch of CAISAR to the
# public pub group at git.frama-c.com/pub/caisar.
# For that, it uses the 'caisar to caisar-public' deploy key stored in the
# public repository. This is the public key of the private one stored in the
# variable $CAISAR_PUBLIC_SSH_PRIVATE_KEY of private repository.

make_public:
  stage: make_public
  image: ocaml/opam@sha256:013a26ccbaa8344b63274e335e2492c432cec1c3526b9ba888ab151abb2b4c25
  script:
    - echo "$CAISAR_PUBLIC_SSH_PRIVATE_KEY" | base64 -d > ci/caisar-public/id_ed25519
    - chmod 400 ci/caisar-public/id_ed25519
    - GIT_SSH=$PWD/ci/caisar-public/ssh.sh git push git@git.frama-c.com:pub/caisar.git origin/master:refs/heads/master
  tags:
    - docker
  only:
    - schedules