From f69079dd90ef3a9caa71501c503adbe113bfc392 Mon Sep 17 00:00:00 2001 From: Matteo Ravasi Date: Sat, 11 Feb 2023 15:41:08 +0300 Subject: [PATCH] ci: full restyling of CI pipelines (#471) * removed `.travis.yml` since our Travis-CI always runs out of free token (and I always need to ask to get more... too tedious process). Also have 2 CIs (Github Action and Azure Pipelines air) should be good enough, no need for 3. * added `macos-latest` to our Github Action `build` and 4 python versions (from 3.7 to 3.10) * created a new Github Action `codacy-coverage-reporter` to upload coverage to Codacy. This runs tests only for one python version on ubuntu. --- .github/workflows/build.yaml | 6 ++-- .../workflows/codacy-coverage-reporter.yaml | 34 ++++++++++++++----- .travis.yml | 17 ---------- Makefile | 3 ++ 4 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7912112c..f6852e4c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,12 +4,12 @@ on: [push, pull_request] jobs: build: - - runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + platform: [ ubuntu-latest, macos-latest ] + python-version: ["3.7", "3.8", "3.9", "3.10"] + runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 72e640ce..b0a8f90d 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -2,16 +2,32 @@ # For more information see: https://github.com/codacy/codacy-coverage-reporter-action name: PyLops-coverage -on: [push, pull_request] +on: [push, pull_request_target] jobs: - codacy-coverage-reporter: + build: + runs-on: ubuntu-latest - name: codacy-coverage-reporter steps: - - uses: actions/checkout@v3 - - name: Run codacy-coverage-reporter - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./ + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest coverage + if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi + - name: Install pylops + run: | + pip install . + - name: Code coverage with coverage + run: | + coverage run -m pytest + coverage xml + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b3015acc..00000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: python - -python: - - "3.8" - -os: - - linux - -script: - - pip3 install --upgrade setuptools - - pip3 install -r requirements-dev.txt - - pip3 install coverage codacy-coverage - - pip3 install . - - python3 setup.py test - -after_success: - - 'if [ ! -z "${CODACY_PROJECT_TOKEN}" ]; then coverage run setup.py test; coverage xml; bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml; fi' diff --git a/Makefile b/Makefile index 65464758..0ac4b3d5 100755 --- a/Makefile +++ b/Makefile @@ -48,3 +48,6 @@ lint: typeannot: mypy pylops/ + +coverage: + coverage run -m pytest && coverage xml && coverage html && $(PYTHON) -m http.server --directory htmlcov/