From 4b9219a696a943dbcd71c5d12cdbc5dd2540129f Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Wed, 30 Sep 2020 15:54:56 -0300 Subject: [PATCH] Replace TravisCI and Azure for GitHub Actions (#189) Add GitHub Actions workflows for checking style, testing and deploying Harmonica, based on the workflows of Pooch. Remove TravisCI and Azure configuration files. Split make check target in two: make black-check and make flake8. Ditch Travis and Azure badges on README.rst. Add new GitHub Actions badge. Tests are run on every matrix configuration: all OSs and all Python versions. Documentation building is only run under Ubuntu with Python 3.8. --- .azure-pipelines.yml | 246 ------------------ .github/workflows/continuous-integration.yml | 190 ++++++++++++++ .github/workflows/deploy.yml | 258 +++++++++++++++++++ .github/workflows/style.yml | 87 +++++++ .travis.yml | 115 --------- Makefile | 6 +- README.rst | 9 +- 7 files changed, 543 insertions(+), 368 deletions(-) delete mode 100644 .azure-pipelines.yml create mode 100644 .github/workflows/continuous-integration.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/style.yml delete mode 100644 .travis.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml deleted file mode 100644 index ed6e6be16..000000000 --- a/.azure-pipelines.yml +++ /dev/null @@ -1,246 +0,0 @@ -# Configuration for Azure Pipelines -######################################################################################## - -# Only build the master branch, tags, and PRs (on by default) to avoid building random -# branches in the repository until a PR is opened. -trigger: - branches: - include: - - master - - refs/tags/* - -# Make sure triggers are set for PRs to any branch. -pr: - branches: - include: - - '*' - - -jobs: - -# Linux -######################################################################################## -- job: - displayName: 'Style Checks' - - pool: - vmImage: 'ubuntu-16.04' - - variables: - CONDA_INSTALL_EXTRA: "black>=20.8b1 flake8 pylint" - PYTHON: '3.7' - - steps: - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - - - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" - displayName: Add conda to PATH - - # Get the Fatiando CI scripts - - bash: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git - displayName: Fetch the Fatiando CI scripts - - # Setup dependencies and build a conda environment - - bash: source continuous-integration/azure/setup-miniconda.sh - displayName: Setup Miniconda - - # Show installed pkg information for postmortem diagnostic - - bash: | - set -x -e - source activate testing - conda list - displayName: List installed packages - - # Check that the code passes format checks - - bash: | - set -x -e - source activate testing - make check - displayName: Formatting check (black and flake8) - condition: succeededOrFailed() - - # Check that the code passes linting checks - - bash: | - set -x -e - source activate testing - make lint - displayName: Linting (pylint) - condition: succeededOrFailed() - - -# Mac -######################################################################################## -- job: - displayName: 'Mac' - - pool: - vmImage: 'macOS-10.15' - - variables: - CONDA_REQUIREMENTS: requirements.txt - CONDA_REQUIREMENTS_DEV: requirements-dev.txt - CONDA_INSTALL_EXTRA: "codecov" - HARMONICA_DATA_DIR: "$(Agent.TempDirectory)/.harmonica/data" - - strategy: - matrix: - Python38: - python.version: '3.8' - PYTHON: '3.8' - Python37: - python.version: '3.7' - PYTHON: '3.7' - Python36: - python.version: '3.6' - PYTHON: '3.6' - - steps: - - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - # On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation - # directory We need to take ownership if we want to update conda or install packages - # globally - - bash: sudo chown -R $USER $CONDA - displayName: Take ownership of conda installation - - # Get the Fatiando CI scripts - - bash: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git - displayName: Fetch the Fatiando CI scripts - - # Setup dependencies and build a conda environment - - bash: source continuous-integration/azure/setup-miniconda.sh - displayName: Setup Miniconda - - # Show installed pkg information for postmortem diagnostic - - bash: | - set -x -e - source activate testing - conda list - displayName: List installed packages - - # Copy the test data to the cache folder - - bash: | - set -x -e - mkdir -p ${HARMONICA_DATA_DIR}/master - cp -r data/* ${HARMONICA_DATA_DIR}/master - displayName: Copy test data to cache - - # Install the package - - bash: | - set -x -e - source activate testing - python setup.py bdist_wheel - pip install dist/* - displayName: Install the package - - # Run the tests - - bash: | - set -x -e - source activate testing - make test - displayName: Test - - # Build the documentation - - bash: | - set -x -e - source activate testing - make -C doc clean all - displayName: Build the documentation - - # Upload test coverage if there were no failures - - bash: | - set -x -e - source activate testing - coverage xml - echo "Uploading coverage to Codecov" - codecov -e PYTHON AGENT_OS - env: - CODECOV_TOKEN: $(codecov.token) - condition: succeeded() - displayName: Upload coverage - - -# Windows -######################################################################################## -- job: - displayName: 'Windows' - - pool: - vmImage: 'vs2017-win2016' - - variables: - CONDA_REQUIREMENTS: requirements.txt - CONDA_REQUIREMENTS_DEV: requirements-dev.txt - CONDA_INSTALL_EXTRA: "codecov" - HARMONICA_DATA_DIR: "$(Agent.TempDirectory)/.harmonica/data" - - strategy: - matrix: - Python38: - python.version: '3.8' - PYTHON: '3.8' - Python37: - python.version: '3.7' - PYTHON: '3.7' - Python36: - python.version: '3.6' - PYTHON: '3.6' - - steps: - - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - # Get the Fatiando CI scripts - - script: git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git - displayName: Fetch the Fatiando CI scripts - - # Setup dependencies and build a conda environment - - script: continuous-integration/azure/setup-miniconda.bat - displayName: Setup Miniconda - - # Show installed pkg information for postmortem diagnostic - - bash: | - set -x -e - source activate testing - conda list - displayName: List installed packages - - # Copy the test data to the cache folder - - bash: | - set -x -e - mkdir -p ${HARMONICA_DATA_DIR}/master - cp -r data/* ${HARMONICA_DATA_DIR}/master - displayName: Copy test data to cache - - # Install the package that we want to test - - bash: | - set -x -e - source activate testing - python setup.py sdist --formats=zip - pip install dist/* - displayName: Install the package - - # Run the tests - - bash: | - set -x -e - source activate testing - make test - displayName: Test - - # Upload test coverage if there were no failures - - bash: | - set -x -e - source activate testing - coverage report -m - coverage xml - codecov -e PYTHON AGENT_OS - env: - CODECOV_TOKEN: $(codecov.token) - condition: succeeded() - displayName: Upload coverage diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 000000000..1c588e459 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,190 @@ +# Configuration for testing and deploying with GitHub Actions +# +# NOTE: Pin actions to a specific commit to avoid having the authentication +# token stolen if the Action is compromised. See the comments and links here: +# https://github.com/pypa/gh-action-pypi-publish/issues/27 +# +name: test + +# Only build PRs, the master branch, and releases. Pushes to branches will only +# be built when a PR is opened. This avoids duplicated buids in PRs comming +# from branches in the origin repository (1 for PR and 1 for push). +on: + pull_request: + push: + branches: + - master + release: + types: + - published + +# Use bash by default in all jobs +defaults: + run: + # The -l {0} is necessary for conda environments to be activated + shell: bash -l {0} + +jobs: + ############################################################################# + # Run tests, build the docs, and deploy if needed + test: + name: ${{ matrix.os }} py${{ matrix.python }} ${{ matrix.dependencies }} + runs-on: ${{ matrix.os }}-latest + strategy: + # Otherwise, the workflow would stop if a single job fails. We want to + # run all of them to catch failures in different combinations. + fail-fast: false + matrix: + os: [ubuntu, macos, windows] + python: [3.6, 3.7, 3.8] + # If "optional", will install non-required dependencies in the build + # environment. Otherwise, only required dependencies are installed. + dependencies: [""] + include: + - os: ubuntu + python: 3.8 + - os: macos + python: 3.8 + - os: windows + python: 3.8 + env: + CONDA_REQUIREMENTS: requirements.txt + CONDA_REQUIREMENTS_DEV: requirements-dev.txt + CONDA_INSTALL_EXTRA: + # Used to tag codecov submissions + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python }} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE + - name: Checkout + uses: actions/checkout@v2 + with: + # Need to fetch more than the last commit so that versioneer can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + + # Need the tags so that versioneer can form a valid version number + - name: Fetch git tags + run: git fetch origin 'refs/tags/*:refs/tags/*' + + - name: Setup caching for conda packages + uses: actions/cache@v2 + with: + path: ~/conda_pkgs_dir + key: conda-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('requirements*.txt') }} + + - name: Setup miniconda + uses: goanpeca/setup-miniconda@v1 + with: + python-version: ${{ matrix.python }} + miniconda-version: "latest" + auto-update-conda: true + channels: conda-forge + show-channel-urls: true + activate-environment: testing + # Needed for caching + use-only-tar-bz2: true + + - name: Install requirements + run: | + requirements_file=full-conda-requirements.txt + if [ ! -z "$CONDA_REQUIREMENTS" ]; then + echo "Capturing dependencies from $CONDA_REQUIREMENTS" + cat $CONDA_REQUIREMENTS >> $requirements_file + fi + if [ ! -z "$CONDA_REQUIREMENTS_DEV" ]; then + echo "Capturing dependencies from $CONDA_REQUIREMENTS_DEV" + cat $CONDA_REQUIREMENTS_DEV >> $requirements_file + fi + if [ ! -z "$CONDA_INSTALL_EXTRA" ]; then + echo "Capturing extra dependencies: $CONDA_INSTALL_EXTRA" + echo "# Extra" >> $requirements_file + # Use xargs to print one argument per line + echo $CONDA_INSTALL_EXTRA | xargs -n 1 >> $requirements_file + fi + if [ -f $requirements_file ]; then + echo "Collected dependencies:" + cat $requirements_file + echo "" + conda install --quiet --file $requirements_file python=$PYTHON + else + echo "No requirements defined." + fi + + - name: List installed packages + run: conda list + + - name: Build source and wheel distributions + run: | + python setup.py sdist bdist_wheel + echo "" + echo "Generated files:" + ls -lh dist/ + + - name: Install the package + run: pip install --no-deps dist/*.whl + + - name: Copy test data to cache + run: | + echo "Copy data to " ${HARMONICA_DATA_DIR}/master + set -x -e + mkdir -p ${HARMONICA_DATA_DIR}/master + cp -r data/* ${HARMONICA_DATA_DIR}/master + env: + # Define directory where sample data will be copied + HARMONICA_DATA_DIR: ${{ runner.temp }}/cache/harmonica + + - name: Run the tests + run: | + ls $HARMONICA_DATA_DIR + if [ ${{ matrix.os }} == 'ubuntu' ]; then + # Use NUMBA_THREADING_LAYER to workqueue on Ubuntu to prevent + # endless loop on some test functions that make use of Numba + NUMBA_THREADING_LAYER=workqueue make test + else + make test + fi + env: + # Define directory where sample data have been copied + HARMONICA_DATA_DIR: ${{ runner.temp }}/cache/harmonica + + # ----------------------------------------------------------- + # The following steps will run only on Ubuntu with Python 3.8 + # ----------------------------------------------------------- + + - name: Build the documentation + if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }} + run: make -C doc clean all + env: + # Define directory where sample data have been copied + HARMONICA_DATA_DIR: ${{ runner.temp }}/cache/harmonica + + # Store the docs as a build artifact on GitHub so we can check it if + # needed. + - name: Upload HTML documentation as an artifact + if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }} + uses: actions/upload-artifact@v2 + with: + name: docs-${{ matrix.os }}-${{ matrix.python }}${{ matrix.dependencies }}-{{ github.sha }} + path: doc/_build/html + + - name: Convert coverage report to XML for codecov + if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }} + run: coverage xml + + - name: Upload coverage to Codecov + if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }} + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + env_vars: OS,PYTHON + # Don't mark the job as failed if the upload fails for some reason. + # It does sometimes but shouldn't be the reason for running + # everything again unless something else is broken. + fail_ci_if_error: false diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..ec74d8424 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,258 @@ +# Configuration for publishing archives to PyPI and documentation pages to +# GitHub Pages using GitHub Actions. +# +# NOTE: Pin actions to a specific commit to avoid having the authentication +# token stolen if the Action is compromised. See the comments and links here: +# https://github.com/pypa/gh-action-pypi-publish/issues/27 +# +name: deploy + +# Only run for pushes to the master branch and releases. +on: + push: + branches: + - master + release: + types: + - published + +# Use bash by default in all jobs +defaults: + run: + # The -l {0} is necessary for conda environments to be activated + shell: bash -l {0} + +jobs: + + ############################################################################# + # Publish built wheels and source archives to PyPI and test PyPI + pypi: + name: PyPI + runs-on: ubuntu-latest + # Only publish from the origin repository, not forks + if: github.repository == 'fatiando/harmonica' + + steps: + + # Checks-out your repository under $GITHUB_WORKSPACE + - name: Checkout + uses: actions/checkout@v2 + with: + # Need to fetch more than the last commit so that versioneer can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version will still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + + # Need the tags so that versioneer can form a valid version number + - name: Fetch git tags + run: git fetch origin 'refs/tags/*:refs/tags/*' + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install requirements + run: python -m pip install setuptools twine wheel + + - name: List installed packages + run: python -m pip freeze + + - name: Build source and wheel distributions + run: | + # Change the versioneer format to "pre" so that the commit hash isn't + # included (PyPI doesn't allow it). Can't do this permanently because + # we rely the hash to indicate to the tests that this is a local + # verison instead of a published version. + sed --in-place "s/pep440/pep440-pre/g" setup.cfg + python setup.py sdist bdist_wheel + echo "" + echo "Generated files:" + ls -lh dist/ + + - name: Check the archives + run: twine check dist/* + + - name: Publish to Test PyPI + if: success() + uses: pypa/gh-action-pypi-publish@bce3b74dbf8cc32833ffba9d15f83425c1a736e0 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_TOKEN}} + repository_url: https://test.pypi.org/legacy/ + # Allow existing releases on test PyPI without errors. + # NOT TO BE USED in PyPI! + skip_existing: true + + - name: Publish to PyPI + # Only publish to PyPI when a release triggers the build + if: success() && github.event_name == 'release' + uses: pypa/gh-action-pypi-publish@bce3b74dbf8cc32833ffba9d15f83425c1a736e0 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN}} + + ############################################################################# + # Publish the documentation to gh-pages + docs: + name: docs + runs-on: ubuntu-latest + # Only publish from the origin repository, not forks + if: github.repository == 'fatiando/harmonica' + env: + CONDA_REQUIREMENTS: requirements.txt + CONDA_REQUIREMENTS_DEV: requirements-dev.txt + CONDA_INSTALL_EXTRA: + PYTHON: 3.8 + + steps: + + # Checks-out your repository under $GITHUB_WORKSPACE + - name: Checkout + uses: actions/checkout@v2 + with: + # Need to fetch more than the last commit so that versioneer can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + + # Need the tags so that versioneer can form a valid version number + - name: Fetch git tags + run: git fetch origin 'refs/tags/*:refs/tags/*' + + - name: Setup caching for conda packages + uses: actions/cache@v2 + with: + path: ~/conda_pkgs_dir + key: conda-${{ runner.os }}-${{ env.PYTHON }}-${{ hashFiles('requirements*.txt') }} + + - name: Setup miniconda + uses: goanpeca/setup-miniconda@v1 + with: + python-version: ${{ env.PYTHON }} + miniconda-version: "latest" + auto-update-conda: true + channels: conda-forge + show-channel-urls: true + activate-environment: testing + # Needed for caching + use-only-tar-bz2: true + + - name: Install requirements + run: | + requirements_file=full-conda-requirements.txt + if [ ! -z "$CONDA_REQUIREMENTS" ]; then + echo "Capturing dependencies from $CONDA_REQUIREMENTS" + cat $CONDA_REQUIREMENTS >> $requirements_file + fi + if [ ! -z "$CONDA_REQUIREMENTS_DEV" ]; then + echo "Capturing dependencies from $CONDA_REQUIREMENTS_DEV" + cat $CONDA_REQUIREMENTS_DEV >> $requirements_file + fi + if [ ! -z "$CONDA_INSTALL_EXTRA" ]; then + echo "Capturing extra dependencies: $CONDA_INSTALL_EXTRA" + echo "# Extra" >> $requirements_file + # Use xargs to print one argument per line + echo $CONDA_INSTALL_EXTRA | xargs -n 1 >> $requirements_file + fi + if [ -f $requirements_file ]; then + echo "Collected dependencies:" + cat $requirements_file + echo "" + conda install --quiet --file $requirements_file python=$PYTHON + else + echo "No requirements defined." + fi + + - name: List installed packages + run: conda list + + - name: Build source and wheel distributions + run: | + python setup.py sdist bdist_wheel + echo "" + echo "Generated files:" + ls -lh dist/ + + - name: Install the package + run: pip install --no-deps dist/*.whl + + - name: Build the documentation + run: make -C doc clean all + + - name: Checkout the gh-pages branch in a separate folder + uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b + with: + ref: gh-pages + # Checkout to this folder instead of the current one + path: deploy + # Download the entire history + fetch-depth: 0 + + - name: Push the built HTML to gh-pages + run: | + # Detect if this is a release or from the master branch + if [[ "${{ github.event_name }}" == "release" ]]; then + # Get the tag name without the "refs/tags/" part + version="${GITHUB_REF#refs/*/}" + else + version=dev + fi + echo "Deploying version: $version" + + # Make the new commit message. Needs to happen before cd into deploy + # to get the right commit hash. + message="Deploy $version from $(git rev-parse --short HEAD)" + + cd deploy + + # Need to have this file so that Github doesn't try to run Jekyll + touch .nojekyll + + # Delete all the files and replace with our new set + echo -e "\nRemoving old files from previous builds of ${version}:" + rm -rvf ${version} + echo -e "\nCopying HTML files to ${version}:" + cp -Rvf ../doc/_build/html/ ${version}/ + + # If this is a new release, update the link from /latest to it + if [[ "${version}" != "dev" ]]; then + echo -e "\nSetup link from ${version} to 'latest'." + rm -f latest + ln -sf ${version} latest + fi + + # Stage the commit + git add -A . + echo -e "\nChanges to be applied:" + git status + + # Configure git to be the GitHub Actions account + git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + + # If this is a dev build and the last commit was from a dev build + # (detect if "dev" was in the previous commit message), reuse the + # same commit + if [[ "${version}" == "dev" && `git log -1 --format='%s'` == *"dev"* ]]; then + echo -e "\nAmending last commit:" + git commit --amend --reset-author -m "$message" + else + echo -e "\nMaking a new commit:" + git commit -m "$message" + fi + + # Make the push quiet just in case there is anything that could leak + # sensitive information. + echo -e "\nPushing changes to gh-pages." + git push -fq origin gh-pages 2>&1 >/dev/null + + echo -e "\nFinished uploading generated files." diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 000000000..78ab600bc --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,87 @@ +# Linting and style checks with GitHub Actions +# +# NOTE: Pin actions to a specific commit to avoid having the authentication +# token stolen if the Action is compromised. See the comments and links here: +# https://github.com/pypa/gh-action-pypi-publish/issues/27 +# +name: code-style + +# Only build PRs and the master branch. Pushes to branches will only be built +# when a PR is opened. +on: + pull_request: + push: + branches: + - master + +############################################################################### +jobs: + + black: + name: black [format] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install requirements + run: pip install black>=20.8b1 + + - name: List installed packages + run: pip freeze + + - name: Check code format + run: make black-check + + flake8: + name: flake8 [style] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install requirements + run: pip install flake8 + + - name: List installed packages + run: pip freeze + + - name: Check code style + run: make flake8 + + pylint: + name: pylint [style] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install requirements + run: pip install pylint==2.4.* + + - name: List installed packages + run: pip freeze + + - name: Linting (pylint) + run: make lint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a42055a9..000000000 --- a/.travis.yml +++ /dev/null @@ -1,115 +0,0 @@ -# Configuration file for TravisCI - -# We use miniconda for Python so don't need any Python specific tools -language: generic - -# Use the container builds so we don't need sudo priviledges -sudo: false - -# Only build pushes to the master branch and tags. This avoids the double -# builds than happen when working on a branch instead of a fork. -branches: - only: - - master - # Regex to build tagged commits with version numbers - - /\d+\.\d+(\.\d+)?(\S*)?$/ - -# Define environment variables common to all builds -env: - global: - # Encrypted variables - # Github Token for pushing the built HTML (GH_TOKEN) - - secure: "Xr1Zc6Zu/AyqvDaiSv7Omr6nX67Onfffk8wL5XseREh9IH3iTWcBtM5lU7JyM87czOX1s3tux1+c/2xX7CdP4W8e+EK5npKV53bbC96tl66up5JMP5mzGucatfTfRZ5bJc8MwXiAIUM3LX+8XU/tIAw56c1T0eiNmqdazBuRXsshFUMoIpIQqM7rnhOk3j//VICjZrXiz5MqNUOmVQmvGxdZyW/jgstemD4Vhw4Oh8/kr6cgXSBltFQIc07jVfywd/noNEC1X2V+R7teE+6PUKpINomPKYlLYN2+T21BdrfIkVnHEOZhnr3eft7190+naIuWB9W1V1EbVI9/2OGkFkMUvyZHBN6VaKLQbbrtzmJNt0cgQRqRXWj+XlYtJfGDxGTc020w5oafU7SxXPkcFj1x1304S59pOoVuRemaVT9zwl/Q0mbYH04WxufC6arJCnegT14OUdumw0dXaZ3Zadrb7z8OhI+Pc2AqE3LAgKrcGq2fqjEGzLVRibYwX3vbkIHgVK1RORI6+oInEXLdOc7imH/13HV0wG0VJ6gNkDtdMmmPouDb7fEby6om7yjyQ1rSqTlZT6wv40KRiXyqHA9Lx8BxK1LHB13+sZWigcnrNni834vgzeS5agoFdeOOGBB/8n7f/z98eKu3Bfk3XQLXZjW2FTeTzxovzvhNzA4=" - # PyPI password for deploying releases (TWINE_PASSWORD) - - secure: "ufJKNS+JGD3klJglfML+4gerCOntHlfLX8M1zb3wyf6QbOfqZncvijh5ChVSAsqMeqKJG+hHVUgRN0pPgOyhsCetgeS/QdYsehEZO+UZeni+xdaAZgG/pz0pzxDuIOOTu9CImKIn+hnMSo3cnoO9fASem1c77XvLHs6BcShYpUZTRElvDGcvWlU2aZMA2qO9rVBpRBgr8GK6uLdXqV6yzJznWlQVRSJmpVEVfdNr5cbtgy7gxf2IBL2TXEWzzqwcJc3/bkzGFCwqgJ3aouIeHeWuNJEW23BjfIj6Da7ibsC7cPwS0u96MbBTBNOVInlh6Zy7xQvJpzgYBPTE3P3+HMUF7wS6HVkGyn86kh0JMfTwUjSul9SxGDCSn1JWnH5Ya7S5rGekYPcxE+2gKAt3BHjPM8xIDo6fIPH8zWLXl7xQJDHe/TWc3GRUD2OB+y9fWy+xvuXz7DI41oSHMSAEw6Ob2x7dGPbiSGvWmK0Z6Nm1sBVP/3xGhfhuH48587cbVEU27MAIUCzyJYi2750z3LP5pDP4HGiJsiH/kZLTBTgjxKM0m6+A/quAlARUsiXyf5z9fAqed13EcB/0x8YqqGVHNC79+7eIhEWwPU1h1+NeiTqK2wznzvawdfDtFHtquLC0pqWNq+r76walp+wBG0+jGpK+D/orUoW/x0oVrGo=" - - TWINE_USERNAME=Leonardo.Uieda - - HARMONICA_DATA_DIR="$HOME/.harmonica/data" - # The files with the listed requirements to be installed by conda - - CONDA_REQUIREMENTS=requirements.txt - - CONDA_REQUIREMENTS_DEV=requirements-dev.txt - - CONDA_INSTALL_EXTRA="codecov" - # These variables control which actions are performed in a build - - DEPLOY_DOCS=false - - DEPLOY_PYPI=false - -# Specify the build configurations. Be sure to only deploy from a single build. -matrix: - include: - - name: "Linux - Python 3.8" - os: linux - env: - - PYTHON=3.8 - - name: "Linux - Python 3.7" - os: linux - env: - - PYTHON=3.7 - # Main build to deploy to PyPI and Github pages - - name: "Linux - Python 3.6 (deploy)" - os: linux - env: - - PYTHON=3.6 - - DEPLOY_DOCS=true - - DEPLOY_PYPI=true - -# Setup the build environment -before_install: - # Copy sample data to the verde data dir to avoid downloading all the time - - mkdir -p $HARMONICA_DATA_DIR/master - - cp -r data/* $HARMONICA_DATA_DIR/master - # Get the Fatiando CI scripts - - git clone --branch=1.1.1 --depth=1 https://github.com/fatiando/continuous-integration.git - # Download and install miniconda and setup dependencies - # Need to source the script to set the PATH variable globaly - - source continuous-integration/travis/setup-miniconda.sh - # Show installed pkg information for postmortem diagnostic - - conda list - -# Install the package that we want to test -install: - # Make a binary wheel for our package and install it - - python setup.py bdist_wheel - - pip install dist/* - -# Run the actual tests and checks -script: - # Run the test suite - # (explicit NUMBA_THREADING_LAYER to bypass Numba v0.5.0 bug that generate - # an infinite loop on CIs running Ubuntu) - # https://github.com/numba/numba/issues/5983 - - NUMBA_THREADING_LAYER=workqueue make test - # Build the documentation - - NUMBA_THREADING_LAYER=workqueue make -C doc clean all - -# Things to do if the build is successful -after_success: - # Upload coverage information - - coverage xml - - echo "Uploading coverage to Codecov" - - codecov -e PYTHON - -# Deploy -deploy: - # Make a release on PyPI - - provider: script - script: continuous-integration/travis/deploy-pypi.sh - on: - tags: true - condition: '$DEPLOY_PYPI == "true"' - # Push the built HTML in doc/_build/html to the gh-pages branch - - provider: script - script: continuous-integration/travis/deploy-gh-pages.sh - skip_cleanup: true - on: - branch: master - condition: '$DEPLOY_DOCS == "true"' - # Push HTML when building tags as well - - provider: script - script: continuous-integration/travis/deploy-gh-pages.sh - skip_cleanup: true - on: - tags: true - condition: '$DEPLOY_DOCS == "true"' - -# Don't send out emails every time a build fails -notifications: - email: false diff --git a/Makefile b/Makefile index 27de3cc71..715f24e88 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,12 @@ test_numba: format: black $(BLACK_FILES) -check: +check: black-check flake8 + +black-check: black --check $(BLACK_FILES) + +flake8: flake8 $(FLAKE8_FILES) lint: diff --git a/README.rst b/README.rst index c1a096df6..d3b906417 100644 --- a/README.rst +++ b/README.rst @@ -9,15 +9,12 @@ Part of the `Fatiando a Terra `__ project .. image:: http://img.shields.io/pypi/v/harmonica.svg?style=flat-square :alt: Latest version on PyPI :target: https://pypi.python.org/pypi/harmonica -.. image:: http://img.shields.io/travis/fatiando/harmonica/master.svg?style=flat-square&label=TravisCI - :alt: TravisCI build status - :target: https://travis-ci.org/fatiando/harmonica +.. image:: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ffatiando%2Fharmonica%2Fbadge%3Fref%3Dmaster&style=flat-square + :alt: GitHub Actions status + :target: https://actions-badge.atrox.dev/fatiando/harmonica/goto?ref=master .. image:: http://img.shields.io/appveyor/ci/fatiando/harmonica/master.svg?style=flat-square&label=AppVeyor :alt: AppVeyor build status :target: https://ci.appveyor.com/project/fatiando/harmonica -.. image:: https://img.shields.io/azure-devops/build/fatiando/468a030e-9766-495e-b0d6-b94ff15ff50b/5/master.svg?label=Azure&style=flat-square - :alt: Azure Pipelines build status - :target: https://dev.azure.com/fatiando/harmonica/_build .. image:: https://img.shields.io/codecov/c/github/fatiando/harmonica/master.svg?style=flat-square :alt: Test coverage status :target: https://codecov.io/gh/fatiando/harmonica