diff --git a/.travis/setup.sh b/.ci/setup.sh similarity index 100% rename from .travis/setup.sh rename to .ci/setup.sh diff --git a/.travis/test.sh b/.ci/test.sh similarity index 75% rename from .travis/test.sh rename to .ci/test.sh index 06369794..5a625363 100644 --- a/.travis/test.sh +++ b/.ci/test.sh @@ -2,12 +2,14 @@ set -e -cd $TRAVIS_BUILD_DIR +cd $BUILD_DIRECTORY if [[ $TEST == "API" ]]; then flake8 . pytest -v tests/ --cov=m2cgen/ --ignore=tests/e2e/ - coveralls + if [[ $TRAVIS == "true" ]]; then + coveralls + fi fi if [[ $TEST == "E2E" ]]; then diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..55274835 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: GitHub Actions + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: "Python ${{ matrix.python }}, Test: ${{ matrix.lang }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: + - 3.6 + - 3.7 + - 3.8 + lang: + - "API" + - "c_lang or python or java or go_lang or javascript or php or haskell or ruby" + - "c_sharp or visual_basic or powershell" + - "r_lang or dart" + steps: + - name: Checkout repository + uses: actions/checkout@v1 + with: + fetch-depth: 5 + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Setup dependencies and run tests + run: | + if [[ "${{ matrix.lang }}" == "API" ]]; then + export TEST="API"; + else + export TEST="E2E"; + export LC_ALL="en_US.UTF-8"; + sudo locale-gen $LC_ALL; + sudo update-locale; + fi + export PYTHON="${{ matrix.python }}" + export LANG="${{ matrix.lang }}" + export BUILD_DIRECTORY=$GITHUB_WORKSPACE + bash $GITHUB_WORKSPACE/.ci/setup.sh + pip install Cython numpy + pip install -r $GITHUB_WORKSPACE/requirements-test.txt + bash $GITHUB_WORKSPACE/.ci/test.sh diff --git a/.travis.yml b/.travis.yml index d9e4da35..9ec47562 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,12 @@ env: - TEST=E2E LANG="r_lang or dart" before_install: - - bash .travis/setup.sh + - bash .ci/setup.sh install: - pip install Cython - pip install -r requirements-test.txt script: - - bash .travis/test.sh + - export BUILD_DIRECTORY=$TRAVIS_BUILD_DIR + - bash .ci/test.sh diff --git a/README.md b/README.md index 2b06600f..05e32419 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # m2cgen -[![Build Status](https://travis-ci.org/BayesWitnesses/m2cgen.svg?branch=master)](https://travis-ci.org/BayesWitnesses/m2cgen) +[![Travis Status](https://travis-ci.org/BayesWitnesses/m2cgen.svg?branch=master)](https://travis-ci.org/BayesWitnesses/m2cgen) +[![GitHub Actions Status](https://github.com/BayesWitnesses/m2cgen/workflows/GitHub%20Actions/badge.svg?branch=master)](https://github.com/BayesWitnesses/m2cgen/actions) [![Coverage Status](https://coveralls.io/repos/github/BayesWitnesses/m2cgen/badge.svg?branch=master)](https://coveralls.io/github/BayesWitnesses/m2cgen?branch=master) [![License: MIT](https://img.shields.io/github/license/BayesWitnesses/m2cgen.svg)](https://github.com/BayesWitnesses/m2cgen/blob/master/LICENSE) [![Python Versions](https://img.shields.io/pypi/pyversions/m2cgen.svg?logo=python&logoColor=white)](https://pypi.org/project/m2cgen)