-
Notifications
You must be signed in to change notification settings - Fork 55
/
.cirrus.yml
152 lines (123 loc) · 6.29 KB
/
.cirrus.yml
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
151
152
# Copyright (c) 2023 Ribose Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
freebsd_instance:
image: freebsd-13-2-release-amd64
task:
name: build
only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BRANCH =~ 'release/.*' || $CIRRUS_PR != ''
skip: "!changesInclude('.cirrus.yml') && changesIncludeOnly('/*.sh', '/.*', '/_*', 'Brewfile', 'docs/**', '**.adoc', '**.md', '**.nix', 'flake.lock', 'version.txt', '.github/**') || $CIRRUS_CHANGE_MESSAGE =~ '.*skip ci.*'"
env:
matrix:
- { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: openssl, CRYPTO_LIB_INSTALL: openssl, SHARED_LIBS: on, RNP_LOG_CONSOLE: 1 }
- { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: botan, CRYPTO_LIB_INSTALL: botan2, SHARED_LIBS: on, RNP_LOG_CONSOLE: 1 }
- { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: botan, CRYPTO_LIB_INSTALL: botan2, SHARED_LIBS: off, RNP_LOG_CONSOLE: 1 }
dependencies_script: |
pkg install -y gcc cmake pkgconf googletest gnupg $CRYPTO_LIB_INSTALL json-c rubygem-asciidoctor
user_script: |
pw useradd -n rnpuser -m
printf "\nrnpuser ALL=(ALL) NOPASSWD: ALL\n" > /usr/local/etc/sudoers.d/rnpuser
chown -R rnpuser:rnpuser "$PWD"
configure_script: |
su rnpuser -c 'cmake . -B build \
-DBUILD_SHARED_LIBS=$SHARED_LIBS \
-DCMAKE_BUILD_TYPE=Release \
-DDOWNLOAD_GTEST=OFF \
-DCRYPTO_BACKEND=$CRYPTO_BACKEND'
build_script: |
su rnpuser -c 'cmake --build build --config Release --parallel $(sysctl -n hw.ncpu)'
test_script: |
su rnpuser -c 'mkdir -p build/Testing/Temporary'
su rnpuser -c 'cp cmake/CTestCostData.txt build/Testing/Temporary'
su rnpuser -c 'PATH=$PWD/build/src/lib:$PATH \
ctest --parallel $(sysctl -n hw.ncpu) --test-dir build -C Debug --output-on-failure'
task:
name: package_source
only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BRANCH =~ 'release/.*' || $CIRRUS_PR != ''
skip: "!changesInclude('.cirrus.yml') && changesIncludeOnly('/*.sh', '/.*', '/_*', 'Brewfile', 'docs/**', '**.adoc', '**.md', '**.nix', 'flake.lock', '.github/**') || $CIRRUS_CHANGE_MESSAGE =~ '.*skip ci.*'"
env:
CIRRUS_CLONE_SUBMODULES: true
dependencies_script: |
pkg install -y gcc cmake pkgconf botan2 json-c rubygem-asciidoctor
configure_script: |
cmake . -B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DCRYPTO_BACKEND=botan \
-DCMAKE_INSTALL_PREFIX=/usr
package_script: |
cpack -B build/source-pkg -G FREEBSD --config build/CPackSourceConfig.cmake
package_source_artifacts:
path: "build/source-pkg/*.pkg"
tests_artifacts:
path: "ci/tests/**"
task:
name: package_binary
depends_on: [ package_source ]
only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BRANCH =~ 'release/.*' || $CIRRUS_PR != ''
skip: "!changesInclude('.cirrus.yml') && changesIncludeOnly('/*.sh', '/.*', '/_*', 'Brewfile', 'docs/**', '**.adoc', '**.md', '**.nix', 'flake.lock', '.github/**') || $CIRRUS_CHANGE_MESSAGE =~ '.*skip ci.*'"
clone_script: |
echo "Not cloning rnp repo"
dependencies_script: |
pkg install -y wget unzip gcc cmake pkgconf botan2 json-c rubygem-asciidoctor bzip2
download_script: |
wget -q https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/package_source.zip
unzip package_source.zip
pkg add --relocate "$PWD" "$(ls ./build/source-pkg/*.pkg)"
configure_script: |
cmake usr/local -B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DCRYPTO_BACKEND=botan \
-DCMAKE_INSTALL_PREFIX=/usr
build_script: |
cmake --build build --config Release --parallel $(sysctl -n hw.ncpu)
install_script: |
cmake --install build
package_script: |
cpack -B build/binary-pkg -G FREEBSD --config build/CPackConfig.cmake
package_binary_artifacts:
path: "build/binary-pkg/*.pkg"
task:
name: test_binary
depends_on: [ package_binary ]
only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BRANCH =~ 'release/.*' || $CIRRUS_PR != ''
skip: "!changesInclude('.cirrus.yml') && changesIncludeOnly('/*.sh', '/.*', '/_*', 'Brewfile', 'docs/**', '**.adoc', '**.md', '**.nix', 'flake.lock', '.github/**') || $CIRRUS_CHANGE_MESSAGE =~ '.*skip ci.*'"
clone_script: |
echo "Not cloning rnp repo"
dependencies_script: |
pkg install -y bash wget git botan2 json-c bzip2
download_script: |
wget -q https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/package_binary.zip
unzip -j package_binary.zip
download_tests_script: |
wget -q https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/tests.zip
unzip tests.zip
setup_shunit_script: |
git clone --depth 1 https://github.com/kward/shunit2 ci/tests/shunit2
test_script: |
ln -s /usr/local/bin/bash /bin/bash
chmod +x ci/tests/pkg-tests.sh
ci/tests/pkg-tests.sh