summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 1c8f6b48710f7512d881d0eaeee446725006ce6f (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
stages:
  - pre-check
  - build
  - test

# These stanzas do some common management tasks before and after the
# job-specific before_script and after_script stanzas are run.
# before_script_start configures any default global state.  The
# job-specific before_script can override this state, if required.
# before_script_end prints out information about the environment to
# improve debugging; it does not modify the environment.
# after_script_end does some common management tasks after the
# job-specific after_script is run.  It prints information about the
# environment, and does some clean up.
#
# Add this to your stanza as follows:
#
#   before_script:
#     - *before_script_start
#     - *** YOUR CODE HERE ***
#     - *before_script_end
#   after_script:
#     - *** YOUR CODE HERE ***
#     - *after_script_end

.before_script_start: &before_script_start
  - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "\$RUSTFLAGS is set ($RUSTFLAGS)"; exit 1; fi'

.before_script_end: &before_script_end
  - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "WARNING: before_script set \$RUSTFLAGS ($RUSTFLAGS)"; fi'
  - rustc --version --verbose
  - cargo --version
  - clang -v
  - if [ -d $CARGO_TARGET_DIR ]; then find $CARGO_TARGET_DIR | wc --lines; du -sh $CARGO_TARGET_DIR; fi
  - if [ -d $CARGO_HOME ]; then find $CARGO_HOME | wc --lines; du -sh $CARGO_HOME; fi

.after_script_end: &after_script_end
  - if [ -d $CARGO_TARGET_DIR ]; then find $CARGO_TARGET_DIR -type f -atime +7 -delete; fi
  - if [ -d $CARGO_TARGET_DIR ]; then du -sh $CARGO_TARGET_DIR; fi
  - if [ -d $CARGO_HOME ]; then du -sh $CARGO_HOME; fi

before_script:
  - *before_script_start
  - *before_script_end

after_script:
  - *after_script_end

# Don't run when merging a commit into main.
#
# We've configured the gitlab project so that the only way to push to
# main is via a merge request for which CI has passed.  As such,
# running (most) jobs when merging to main is a waste of resources,
# and we don't do it by default.
.default_rules:
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      when: on_success

trixie:
  tags:
    - linux
  stage: build
  interruptible: true
  image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/trixie-prebuild:latest
  script:
    - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-nettle,compression --example supported-algorithms
    - $MAKE_TOP test
    - if ! git diff --quiet Cargo.lock ; then echo "Cargo.lock changed.  Please add the change to the corresponding commit." ; git diff ; false ; fi
    - if ! git diff --quiet ; then echo "The build changed the source.  Please investigate." ; git diff ; fi
  rules:
    - !reference [.default_rules, rules]
  variables:
    CARGO_TARGET_DIR: /target
    CARGO_HOME: /cargo

trixie-crypto-rust:
  tags:
    - linux
  stage: build
  interruptible: true
  image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/trixie-prebuild:latest
  dependencies:
    - codespell
  script:
    - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-rust,compression,allow-experimental-crypto,allow-variable-time-crypto --example supported-algorithms
    - cargo test --release --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-rust,compression,allow-experimental-crypto,allow-variable-time-crypto
  rules:
    - !reference [.default_rules, rules]
  variables:
    CARGO_TARGET_DIR: /target
    CARGO_HOME: /cargo

trixie-crypto-openssl:
  tags:
    - linux
  stage: build
  interruptible: true
  image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/trixie-prebuild:latest
  dependencies:
    - codespell
  script:
    - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-openssl,compression --example supported-algorithms
    - cargo test --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-openssl,compression
  rules:
    - !reference [.default_rules, rules]
  variables:
    CARGO_TARGET_DIR: /target
    CARGO_HOME: /cargo

trixie-crypto-botan:
  tags:
    - linux
  stage: build
  interruptible: true
  image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/trixie-prebuild:latest
  script:
    - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-botan2,compression --example supported-algorithms
    - cargo test --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-botan2,compression
  rules:
    - !reference [.default_rules, rules]
  variables:
    CARGO_TARGET_DIR: /target
    CARGO_HOME: /cargo

codespell:
  tags:
    - linux
  stage: pre-check
  interruptible: true
  image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/trixie:latest

  before_script:
    - *before_script_start
    - codespell --version
    - *before_script_end
  script:
    - $MAKE_TOP codespell CODESPELL_FLAGS=--summary
  rules:
    - !reference [.default_rules, rules]

variables:
  DEBIAN_FRONTEND: noninteractive
  CARGO_HOME: $CI_PROJECT_DIR/../cargo
  CARGO_FLAGS: --color always
  CARGO_INCREMENTAL: 0
  RUST_BACKTRACE: full
  CFLAGS: -Werror
  MAKE_TOP: make --file=.Makefile
  QUICKCHECK_GENERATOR_SIZE: 500 # https://github.com/BurntSushi/quickcheck/pull/240