summaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
diff options
context:
space:
mode:
Diffstat (limited to '.cirrus.yml')
-rw-r--r--.cirrus.yml152
1 files changed, 152 insertions, 0 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000..0d0115f
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,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-12-3-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', '.github/**') || $CIRRUS_CHANGE_MESSAGE =~ '.*skip ci.*'"
+ env:
+ matrix:
+ - { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: openssl, CRYPTO_LIB_INSTALL: openssl, SHARED_LIBS: on }
+ - { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: botan, CRYPTO_LIB_INSTALL: botan2, SHARED_LIBS: on }
+ - { CIRRUS_CLONE_SUBMODULES: true, CRYPTO_BACKEND: botan, CRYPTO_LIB_INSTALL: botan2, SHARED_LIBS: off }
+
+ 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