Switch osx CI from Travis CI to Github Actions

This commit is contained in:
Sebastian Messmer 2021-04-09 00:54:28 -07:00
parent 7cab57996d
commit 7e4c4b2122
9 changed files with 152 additions and 91 deletions

View File

@ -0,0 +1,16 @@
name: 'Install OSX dependencies'
description: 'Install OSX dependencies'
inputs:
compiler_homebrew_package:
description: "Which compiler package to install from homebrew"
required: true
runs:
using: "composite"
steps:
- name: Install dependencies
shell: bash
run: |
brew install ninja osxfuse libomp ${{inputs.compiler_homebrew_package}}
pip3 install conan
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default

View File

@ -0,0 +1,42 @@
name: 'Build'
description: 'Compile CryFS'
inputs:
cc:
description: "Which C compiler to use for the build"
required: true
cxx:
description: "Which C++ compiler to use for the build"
required: true
build_type:
description: "Which cmake build type to use (e.g. Release, Debug, RelWithDebInfo)"
required: true
runs:
using: "composite"
steps:
- name: Show build system information
shell: bash
run: |
echo CMake version:
cmake --version
echo Ninja version:
ninja --version
echo CC: ${{inputs.cc}}
${{inputs.cc}} --version
echo CXX: ${{inputs.cxx}}
${{inputs.cxx}} --version
echo CCache:
ccache -s
- name: Run cmake
shell: bash
run: |
mkdir build
cd build
cmake .. -GNinja -DCMAKE_CXX_COMPILER=${{inputs.cxx}} -DCMAKE_C_COMPILER=${{inputs.cc}} -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=${{inputs.build_type}} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
- name: Run ninja
shell: bash
run: |
cd build
ninja
- name: Reduce cache size
shell: bash
run: ccache --evict-older-than 7d

View File

@ -0,0 +1,19 @@
name: 'Test'
description: 'Run CryFS Tests'
runs:
using: "composite"
steps:
- name: Run tests
shell: bash
run: |
cd build
./test/gitversion/gitversion-test
./test/cpp-utils/cpp-utils-test
./test/parallelaccessstore/parallelaccessstore-test
./test/blockstore/blockstore-test
./test/blobstore/blobstore-test
./test/cryfs/cryfs-test
# TODO Also run once fixed
# ./test/fspp/fspp-test
# ./test/cryfs-cli/cryfs-cli-test

73
.github/workflows/main.yaml vendored Normal file
View File

@ -0,0 +1,73 @@
name: CI
on: ['push', 'pull_request']
jobs:
build:
name: Build and Test
strategy:
matrix:
os:
- macos-10.15
compiler:
- cxx: g++-7
cc: gcc-7
homebrew_package: gcc@7
- cxx: g++-8
cc: gcc-8
homebrew_package: gcc@8
- cxx: g++-9
cc: gcc-9
homebrew_package: gcc@9
# - cxx: g++-10
# cc: gcc-10
# homebrew_package: gcc@10
build_type:
- Debug
- Release
- RelWithDebInfo
runs-on: ${{matrix.os}}
env:
# Setting conan cache dir to a location where our Github Cache Action can find it
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache/"
steps:
- name: Checkout
uses: actions/checkout@v1
#TODO Ideally, the Find pip cache location + Setup pip cache step would be part of the setup action that runs pip, but Github doesn't support nested actions yet, see https://github.com/actions/runner/issues/862
- name: Find pip cache location
id: pip_cache_dir
run: |
echo "::set-output name=pip_cache_dir::$(pip3 cache dir)"
shell: bash
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip_cache_dir.outputs.pip_cache_dir }}
key: v0-${{ runner.os }}-setup-pip-${{ github.run_number }}
restore-keys: v0-${{ runner.os }}-setup-pip-
- name: Setup
uses: ./.github/workflows/actions/osx_setup
with:
compiler_homebrew_package: ${{ matrix.compiler.homebrew_package }}
#TODO Ideally, the Setup ccache step would be part of the build action, but Github doesn't support nested actions yet, see https://github.com/actions/runner/issues/862
- name: Setup ccache
uses: hendrikmuhs/ccache-action@7a464b8f54f1e1b78e7eb9d0272bc83072959235 # ccache-action@v1.0.3
with:
key: "v0-${{ runner.os }}-ccache__${{matrix.os}}__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__"
- name: Configure ccache
shell: bash
run: ccache --set-config=compiler_check=content
# TODO Ideally, the Setup conan cache step would be part of the build action, but Github doesn't support nested actions yet, see https://github.com/actions/runner/issues/862
- name: Setup conan cache
uses: actions/cache@v2
with:
path: ${{ env.CONAN_USER_HOME }}
key: "v0-${{ runner.os }}-conancache__${{matrix.os}}__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__-${{ github.run_number }}"
restore-keys: "v0-${{ runner.os }}-conancache__${{matrix.os}}__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__-"
- name: Build
uses: ./.github/workflows/actions/run_build
with:
cxx: ${{ matrix.compiler.cxx }}
cc: ${{ matrix.compiler.cc }}
build_type: ${{ matrix.build_type }}
- name: Test
uses: ./.github/workflows/actions/run_tests

View File

@ -1,15 +0,0 @@
language: cpp
sudo: required
os: osx
compiler:
# - gcc
- clang
env:
- BUILD_TARGET=Debug
- BUILD_TARGET=Release
- BUILD_TARGET=RelWithDebInfo
install:
- .travisci/install.sh
script:
- .travisci/build_and_test.sh
cache: ccache

View File

@ -1,50 +0,0 @@
#!/bin/bash
set -ev
# If using gcc on mac, actually use it ("gcc" just links to clang, but "gcc-4.8" is gcc, https://github.com/travis-ci/travis-ci/issues/2423)
# Note: This must be here and not in install.sh, because environment variables can't be passed between scripts.
if [ "${CXX}" == "g++" ]; then
echo Switch to actual g++ and not just the AppleClang symlink
export CXX="g++-7" CC="gcc-7"
else
echo Do not switch to actual g++ because we are not g++
fi
# Setup ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
export CCACHE_COMPILERCHECK=content
export CCACHE_COMPRESS=1
export CCACHE_SLOPPINESS=include_file_mtime
ccache --max-size=512M
ccache --show-stats
# Detect number of CPU cores
export NUMCORES=`sysctl -n hw.ncpu`
echo Using $NUMCORES cores
echo Using CXX compiler $CXX and C compiler $CC
# Setup target directory
mkdir cmake
cd cmake
cmake --version
# Build
echo Build target: ${BUILD_TARGET}
cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=${BUILD_TARGET}
make -j$NUMCORES
ccache --show-stats
# Test
./test/gitversion/gitversion-test
./test/cpp-utils/cpp-utils-test
./test/parallelaccessstore/parallelaccessstore-test
./test/blockstore/blockstore-test
./test/blobstore/blobstore-test
./test/cryfs/cryfs-test
# TODO Also run once fixed
# ./test/fspp/fspp-test
# ./test/cryfs-cli/cryfs-cli-test

View File

@ -1,24 +0,0 @@
#!/bin/bash
set -e
export HOMEBREW_NO_AUTO_UPDATE=1
# Install newer GCC if we're running on GCC
if [ "${CXX}" == "g++" ]; then
# We need to uninstall oclint because it creates a /usr/local/include/c++ symlink that clashes with the gcc5 package
# see https://github.com/Homebrew/homebrew-core/issues/21172
brew cask uninstall oclint
brew install gcc@7
fi
brew cask install osxfuse
brew install libomp
# By default, travis only fetches the newest 50 commits. We need more in case we're further from the last version tag, so the build doesn't fail because it can't generate the version number.
git fetch --unshallow --tags
pip install conan
# Setup ccache
brew install ccache

View File

@ -1,4 +1,4 @@
# CryFS [![Build Status](https://travis-ci.org/cryfs/cryfs.svg?branch=master)](https://travis-ci.org/cryfs/cryfs) [![CircleCI](https://circleci.com/gh/cryfs/cryfs/tree/master.svg?style=svg)](https://circleci.com/gh/cryfs/cryfs/tree/master) [![Build status](https://ci.appveyor.com/api/projects/status/84ouutflsnap9dlv/branch/master?svg=true)](https://ci.appveyor.com/project/smessmer/cryfs/branch/master)
# CryFS [![CircleCI](https://circleci.com/gh/cryfs/cryfs/tree/master.svg?style=svg)](https://circleci.com/gh/cryfs/cryfs/tree/master) [![Build status](https://ci.appveyor.com/api/projects/status/84ouutflsnap9dlv/branch/master?svg=true)](https://ci.appveyor.com/project/smessmer/cryfs/branch/master)
CryFS encrypts your files, so you can safely store them anywhere. It works well together with cloud services like Dropbox, iCloud, OneDrive and others.
See [https://www.cryfs.org](https://www.cryfs.org).

View File

@ -34,7 +34,7 @@ class CryFSConan(ConanFile):
}
def requirements(self):
if self.settings.os == "Windows":
if self.settings.os == "Windows" or self.settings.os == "Macos":
self.requires("boost/1.69.0@conan/stable")
else:
self.requires("boost/1.65.1@conan/stable")