-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored MacOS workflow to use GHA and homebrew capabilities
- Loading branch information
Showing
5 changed files
with
128 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
# Copyright (c) 2023 [Ribose Inc](https://www.ribose.com). | ||
# All rights reserved. | ||
# This file is a part of rnp | ||
# | ||
# 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. | ||
|
||
name: macos | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/**' | ||
- maxirmx-refactor-macos | ||
paths-ignore: | ||
- '/*.sh' | ||
- '/.*' | ||
|
@@ -30,56 +56,85 @@ on: | |
concurrency: | ||
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}' | ||
cancel-in-progress: true | ||
|
||
env: | ||
CORES: 2 | ||
BUILD_MODE: normal | ||
GPG_VERSION: stable | ||
USE_STATIC_DEPENDENCIES: yes | ||
|
||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.os }} [CC ${{ matrix.env.CC }}; GnuPG stable] | ||
name: ${{ matrix.os }} [ backend ${{ matrix.backend }}, shared libs ${{ matrix.shared_libs }} ] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# On MacOS gcc is alias of clang these days | ||
os: [macos-11, macos-12] | ||
env: | ||
- CC: gcc | ||
CXX: g++ | ||
- CC: clang | ||
CXX: clang++ | ||
backend: [ 'botan' ] | ||
shared_libs: [ 'on' ] | ||
include: | ||
- { os: 'macos-11', backend: '[email protected]', shared_libs: 'on' } | ||
- { os: 'macos-12', backend: 'openssl@3', shared_libs: 'on' } | ||
- { os: 'macos-12', backend: 'botan', shared_libs: 'off' } | ||
|
||
if: "!contains(github.event.head_commit.message, 'skip ci')" | ||
env: ${{ matrix.env }} | ||
timeout-minutes: 250 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
submodules: true | ||
- name: Setup environment | ||
|
||
- name: Configure openssl 1.1 backend | ||
if: ${{ matrix.backend == '[email protected]' }} | ||
run: | | ||
. ci/gha/setup-env.inc.sh | ||
ci/install_noncacheable_dependencies.sh | ||
- name: Cache | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.CACHE_DIR }} | ||
key: ${{ github.workflow }}-${{ matrix.os }}-${{ env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} | ||
- name: Build cache | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
echo "brew \"[email protected]\"" >> Brewfile | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix [email protected])" >> $GITHUB_ENV | ||
echo "CRYPTO_BACKEND=openssl" >> $GITHUB_ENV | ||
- name: Configure openssl 3 backend | ||
if: ${{ matrix.backend == 'openssl@3' }} | ||
run: | | ||
echo "brew \"openssl@3\"" >> Brewfile | ||
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV | ||
echo "CRYPTO_BACKEND=openssl" >> $GITHUB_ENV | ||
- name: Configure botan backend | ||
if: ${{ matrix.backend == 'botan' }} | ||
run: | | ||
set -x | ||
ci/install_cacheable_dependencies.sh | ||
- name: tests | ||
echo "brew \"botan\"" >> Brewfile | ||
echo "CRYPTO_BACKEND=botan" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: brew bundle | ||
|
||
- name: Configure | ||
run: | | ||
ci/run.sh | ||
- name: symbol-visibility | ||
echo "CORES=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV | ||
echo "RNP_INSTALL=$PWD/rnp-install" >> $GITHUB_ENV | ||
cmake -B build -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX="$PWD/rnp-install" \ | ||
-DDOWNLOAD_GTEST=OFF \ | ||
-DCRYPTO_BACKEND=${{ env.CRYPTO_BACKEND }} . | ||
- name: Build | ||
run: cmake --build build --config Release --parallel ${{ env.CORES }} | ||
|
||
- name: Install | ||
run: cmake --install build | ||
|
||
- name: Test | ||
run: | | ||
set -euxo pipefail | ||
nm --extern-only --defined-only --demangle $RNP_INSTALL/lib/librnp.dylib > exports | ||
[ $(grep -c dst_close exports) == "0" ] | ||
[ $(grep -c Botan exports) == "0" ] | ||
[ $(grep -c _rnp_version_string_full exports) == "1" ] | ||
mkdir -p "build/Testing/Temporary" | ||
cp "cmake/CTestCostData.txt" "build/Testing/Temporary" | ||
export PATH="$PWD/build/src/lib:$PATH" | ||
ctest --parallel ${{ env.CORES }} --test-dir build -C Debug --output-on-failure | ||
- name: Checkout shell test framework | ||
if: ${{ matrix.shared_libs == 'on' }} | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: kward/shunit2 | ||
path: ci/tests/shunit2 | ||
|
||
- name: Run additional ci tests | ||
if: ${{ matrix.shared_libs == 'on' }} | ||
run: zsh -o shwordsplit -- ci/tests/ci-tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
brew "[email protected]" | ||
brew "make" | ||
brew "cmake" | ||
brew "autoconf" | ||
brew "automake" | ||
brew "libtool" | ||
brew "pkg-config" | ||
brew "googletest" | ||
brew "gnupg" | ||
brew "wget" | ||
brew "python" | ||
|
||
brew "json-c" | ||
brew "asciidoc" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,30 +54,6 @@ run() { | |
|
||
. ci/lib/cacheable_install_functions.inc.sh | ||
|
||
macos_install() { | ||
brew update-reset | ||
# homebrew fails because `openssl` is a symlink while it tries to remove a directory. | ||
rm /usr/local/Cellar/openssl || true | ||
# homebrew fails to update python 3.9.1 to 3.9.1.1 due to unlinking failure | ||
rm /usr/local/bin/2to3 || true | ||
# homebrew fails to update python from 3.9 to 3.10 due to another unlinking failure | ||
rm /usr/local/bin/idle3 || true | ||
rm /usr/local/bin/pydoc3 || true | ||
rm /usr/local/bin/python3 || true | ||
rm /usr/local/bin/python3-config || true | ||
# homebrew fails to update python from 3.11.0 to 3.11.1 | ||
rm /usr/local/bin/2to3-3.11 || true | ||
rm /usr/local/bin/idle3.11 || true | ||
rm /usr/local/bin/pydoc3.11 || true | ||
rm /usr/local/bin/python3.11 || true | ||
rm /usr/local/bin/python3.11-config || true | ||
# homebrew fails to update [email protected] 1.1.1l to 1.1.1l_1 due to linking failure of nghttp2.h | ||
brew unlink nghttp2 || true | ||
brew update | ||
brew bundle | ||
ensure_automake | ||
} | ||
|
||
freebsd_install() { | ||
local packages=( | ||
git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters