From 7e4c4b2122891d8383d0ff034128ae78b208671e Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 9 Apr 2021 00:54:28 -0700 Subject: [PATCH] Switch osx CI from Travis CI to Github Actions --- .../workflows/actions/osx_setup/action.yaml | 16 ++++ .../workflows/actions/run_build/action.yaml | 42 +++++++++++ .../workflows/actions/run_tests/action.yaml | 19 +++++ .github/workflows/main.yaml | 73 +++++++++++++++++++ .travis.yml | 15 ---- .travisci/build_and_test.sh | 50 ------------- .travisci/install.sh | 24 ------ README.md | 2 +- conanfile.py | 2 +- 9 files changed, 152 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/actions/osx_setup/action.yaml create mode 100644 .github/workflows/actions/run_build/action.yaml create mode 100644 .github/workflows/actions/run_tests/action.yaml create mode 100644 .github/workflows/main.yaml delete mode 100644 .travis.yml delete mode 100755 .travisci/build_and_test.sh delete mode 100755 .travisci/install.sh diff --git a/.github/workflows/actions/osx_setup/action.yaml b/.github/workflows/actions/osx_setup/action.yaml new file mode 100644 index 00000000..9e537944 --- /dev/null +++ b/.github/workflows/actions/osx_setup/action.yaml @@ -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 diff --git a/.github/workflows/actions/run_build/action.yaml b/.github/workflows/actions/run_build/action.yaml new file mode 100644 index 00000000..de452f6c --- /dev/null +++ b/.github/workflows/actions/run_build/action.yaml @@ -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 diff --git a/.github/workflows/actions/run_tests/action.yaml b/.github/workflows/actions/run_tests/action.yaml new file mode 100644 index 00000000..593ddbe1 --- /dev/null +++ b/.github/workflows/actions/run_tests/action.yaml @@ -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 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 00000000..88d9cd66 --- /dev/null +++ b/.github/workflows/main.yaml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 703006d3..00000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/.travisci/build_and_test.sh b/.travisci/build_and_test.sh deleted file mode 100755 index deb90903..00000000 --- a/.travisci/build_and_test.sh +++ /dev/null @@ -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 diff --git a/.travisci/install.sh b/.travisci/install.sh deleted file mode 100755 index 7426fcd0..00000000 --- a/.travisci/install.sh +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 0a08adf7..91fccf73 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/conanfile.py b/conanfile.py index 37a243a1..05259f47 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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")