summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: e0a34f81e0bbb4a655407bbd00410103ca8897ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# SPDX-FileCopyrightText: 2019-2020 Heiko Schaefer <heiko@schaefer.name>
# SPDX-License-Identifier: CC0-1.0

image: rust:latest

#cache:
#  paths:
#    - cargo/registry
#    - cargo/git

reuse:
  image:
    name: fsfe/reuse:latest
    entrypoint: [""]
  script:
    - reuse lint

cargo-test:
  stage: test
  before_script:
    - mkdir -p /run/user/$UID
    - apt update -y -qq
    - apt install -y -qq --no-install-recommends  git rustc cargo clang make pkg-config nettle-dev libssl-dev capnproto libsqlite3-dev ca-certificates valgrind strace python3-dev python3-setuptools python3-cffi python3-pytest gnupg
    - apt clean
  script:
  - cargo test

cargo-fmt:
  script:
    - rustup component add rustfmt
    - cargo fmt -- --check

cargo-clippy:
  before_script:
    - mkdir -p /run/user/$UID
    - apt update -y -qq
    - apt install -y -qq --no-install-recommends  git rustc cargo clang make pkg-config nettle-dev libssl-dev capnproto libsqlite3-dev ca-certificates valgrind strace python3-dev python3-setuptools python3-cffi python3-pytest gnupg
    - apt clean
  script:
    - rustup component add clippy
    - cargo clippy --verbose --tests -- -D warnings

pages:
  image: alpine:latest
  stage: test
  script:
    - echo 'pages'
  artifacts:
    paths:
      - public
  only:
    - master

build_docker:
  stage: deploy
  image: docker:stable

  variables:
    IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
    IMAGE_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  services:
      - docker:stable-dind
  before_script:
    - docker info
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
    - docker pull $IMAGE_LATEST || true
    - docker build --cache-from $IMAGE_LATEST --target openpgp-ca -t $IMAGE_SHA -t $IMAGE_LATEST .
    - docker push $IMAGE_SHA
    - docker push $IMAGE_LATEST
  needs: []

build_docker_restd:
  stage: deploy
  image: docker:stable

  variables:
    IMAGE_LATEST: $CI_REGISTRY_IMAGE/openpgp-ca-restd:latest
    IMAGE_SHA: $CI_REGISTRY_IMAGE/openpgp-ca-restd:$CI_COMMIT_SHA
  services:
    - docker:stable-dind
  before_script:
    - docker info
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
    - docker pull $IMAGE_LATEST || true
    - docker build --cache-from $IMAGE_LATEST --target openpgp-ca-restd -t $IMAGE_SHA -t $IMAGE_LATEST .
    - docker push $IMAGE_SHA
    - docker push $IMAGE_LATEST
  needs: []