From 8c2a9154a4c7c100804993043eb16f7e6ef43747 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Tue, 11 Aug 2020 12:25:04 +0200 Subject: [PATCH] Swap travis for GH action --- .github/workflows/ci.yml | 72 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 70 -------------------------------------- README.md | 20 ++++++----- 3 files changed, 83 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9c421bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: CI + +on: + push: + pull_request: + +jobs: + python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + python setup.py install + - name: Setup Singularity + uses: eWaterCycle/setup-singularity@v3 + with: + singularity-version: 3.5.3 + - name: Pull Docker image + run: docker pull ewatercycle/walrus-grpc4bmi:v0.2.0 + - name: Cache Singularity image + id: cache-singularity-image + uses: actions/cache@v2 + with: + path: ~/.singularity + key: singularity-image + - name: Pull Singularity image + if: steps.cache-singularity-image.outputs.cache-hit != 'true' + run: singularity pull docker://ewatercycle/walrus-grpc4bmi:v0.2.0 + - name: Test with pytest + run: pytest --cov=grpc4bmi --cov-report xml + - name: Correct coverage paths + run: sed -i "s+$PWD/++g" coverage.xml + - name: SonarCloud analysis + uses: sonarsource/sonarcloud-github-action@v1.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + cpp: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Install grpc + uses: ewatercycle/setup-grpc@master + with: + grpc-version: 1.27.2 + - name: Copy grpc to system default + run: | + sudo rsync -a $GRPC_ROOT/ /usr/local + sudo ldconfig + - name: Build dir + run: mkdir -p cpp/build + - name: configure + run: cmake .. + working-directory: cpp/build + - name: make + run: make VERBOSE=1 + working-directory: cpp/build + - name: ctest + run: ctest -V + working-directory: cpp/build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d3da688..0000000 --- a/.travis.yml +++ /dev/null @@ -1,70 +0,0 @@ -matrix: - include: - - language: python - dist: xenial - python: '3.6' - install: - - pip install -r requirements.txt - - python setup.py install - - docker pull ewatercycle/walrus-grpc4bmi:v0.2.0 - - singularity pull docker://ewatercycle/walrus-grpc4bmi:v0.2.0 - script: - - pytest - cache: - - pip - - directories: - - /usr/local - - ~/.singularity - services: - - docker - before_install: - # Build singularity binary - - | - if [[ ! -f /usr/local/bin/singularity ]]; then - sudo apt-get update - sudo apt-get install -y build-essential libssl-dev uuid-dev libgpgme11-dev libseccomp-dev pkg-config squashfs-tools - wget -O /tmp/go1.12.linux-amd64.tar.gz https://dl.google.com/go/go1.12.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf /tmp/go1.12.linux-amd64.tar.gz - export GOPATH=~/go - export PATH=$PATH:/usr/local/go/bin - mkdir -p ~/go/src/github.com/sylabs - cd ~/go/src/github.com/sylabs && \ - git clone https://github.com/sylabs/singularity.git && \ - cd singularity - git checkout v3.1.0 - ./mconfig && \ - cd ./builddir && \ - make && \ - sudo make install - cd ${TRAVIS_BUILD_DIR} - fi - - language: cpp - before_install: - - git submodule update --init - - sudo apt-get update - - sudo apt-get install -y build-essential autoconf libtool pkg-config - - | - if [[ ! -f /usr/local/bin/protoc || ! -f /usr/local/bin/grpc_cpp_plugin ]]; then - git clone -b v1.25.0 https://github.com/grpc/grpc - cd grpc - git submodule update --init --recursive - cd third_party/protobuf - ./autogen.sh - ./configure - sudo make -j4 install - cd ../.. - sudo make -j4 install - cd ${TRAVIS_BUILD_DIR} - else - echo "using cached builds of protobuf and grpc" - fi - cd ${TRAVIS_BUILD_DIR}/cpp/bmi-c && mkdir -p build && cd build - cmake .. && sudo make install - script: - - mkdir -p ${TRAVIS_BUILD_DIR}/cpp/build && cd ${TRAVIS_BUILD_DIR}/cpp/build - - cmake .. - - make - - ctest -V - cache: - directories: - - /usr/local diff --git a/README.md b/README.md index 7139dbc..5f9a666 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ +# grpc4bmi + [![DOI](https://zenodo.org/badge/130237165.svg)](https://zenodo.org/badge/latestdoi/130237165) -[![Build Status](https://travis-ci.org/eWaterCycle/grpc4bmi.svg?branch=master)](https://travis-ci.org/eWaterCycle/grpc4bmi) +[![CI](https://github.com/eWaterCycle/grpc4bmi/workflows/CI/badge.svg)](https://github.com/eWaterCycle/grpc4bmi/actions?query=workflow%3ACI) [![Documentation Status](https://readthedocs.org/projects/grpc4bmi/badge/?version=latest)](https://grpc4bmi.readthedocs.io/en/latest/?badge=latest) - -# grpc4bmi +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=grpc4bmi&metric=alert_status)](https://sonarcloud.io/dashboard?id=grpc4bmi) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=grpc4bmi&metric=coverage)](https://sonarcloud.io/dashboard?id=grpc4bmi) ## Purpose @@ -35,10 +37,10 @@ For inspiration look at the example in the test directory. To start a server pro ```bash run-bmi-server --name .. --port --path ``` -where ```, ``` are the python package and module containing your implementation, `````` is your -bmi model class name, `````` is any available port on the host system, and optionally `````` denotes an -additional path that should be added to the system path to make your implementation work. The name option above is -optional, and if not provided the script will look at the environment variables ```BMI_PACKAGE```, ```BMI_MODULE``` and +where ```, ``` are the python package and module containing your implementation, `````` is your +bmi model class name, `````` is any available port on the host system, and optionally `````` denotes an +additional path that should be added to the system path to make your implementation work. The name option above is +optional, and if not provided the script will look at the environment variables ```BMI_PACKAGE```, ```BMI_MODULE``` and ```BMI_CLASS```. Similarly, the port can be defined by the environment variable ```BMI_PORT```. This software assumes that your implementation constructor has no parameters. @@ -77,7 +79,7 @@ mymodel.initialize() ...further BMI calls... ``` -The package contains also client implementation that own the server process, either as a python subprocess or a docker +The package contains also client implementation that own the server process, either as a python subprocess or a docker image or a singularity image running the ```run-bmi-server``` script. For instance ```python from grpc4bmi.bmi_client_subproc import BmiClientSubProcess @@ -109,7 +111,7 @@ pip install -e .[R] ``` and install the C++ runtime and `protoc` command as described in . -After this, simply executing the `proto_gen.sh` script should do the job. +After this, simply executing the `proto_gen.sh` script should do the job. ## Future work