From 6946d99ff74a757f71a86ecf4077f5625f960494 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Fri, 18 Dec 2020 15:24:13 -0500 Subject: [PATCH] Migrate to GH Actions. --- .github/CONTRIBUTING.md | 74 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 27 +++++++++ .github/PULL_REQUEST_TEMPLATE.md | 17 ++++++ .github/workflows/flake8.yml | 26 ++++++++ .github/workflows/testing.yml | 46 ++++++++++++++ .travis.yml | 22 ------- README.md | 2 + continuous_integration/scripts/install.sh | 12 ++++ 8 files changed, 204 insertions(+), 22 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/flake8.yml create mode 100644 .github/workflows/testing.yml delete mode 100644 .travis.yml create mode 100644 continuous_integration/scripts/install.sh diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..ab070b9 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,74 @@ +# Contributing + +## Getting Started + +* Make sure you have a [GitHub account](https://github.com/signup/free) +* Submit a ticket for your issue, assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Make sure you fill in the earliest version that you know has the issue. +* Fork the repository on GitHub + + +## Making Changes + +* Create a topic branch from where you want to base your work. + * This is usually the master branch. + * Only target release branches if you are certain your fix must be on that + branch. + * To quickly create a topic branch based on master; `git checkout -b + fix/master/my_contribution master`. Please avoid working directly on the + `master` branch. +* Make commits of logical units. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Make sure your commit messages are in the proper format (see below) +* Make sure you have added the necessary tests for your changes. +* Run _all_ the tests to assure nothing else was accidentally broken. + +### Writing the commit message + +Commit messages should be clear and follow a few basic rules. Example: + +``` +ENH: add functionality X to bluesky.. + +The first line of the commit message starts with a capitalized acronym +(options listed below) indicating what type of commit this is. Then a blank +line, then more text if needed. Lines shouldn't be longer than 72 +characters. If the commit is related to a ticket, indicate that with +"See #3456", "See ticket 3456", "Closes #3456" or similar. +``` + +Describing the motivation for a change, the nature of a bug for bug fixes +or some details on what an enhancement does are also good to include in a +commit message. Messages should be understandable without looking at the code +changes. + +Standard acronyms to start the commit message with are: +``` +API: an (incompatible) API change +BLD: change related to building numpy +BUG: bug fix +CI : continuous integration +DEP: deprecate something, or remove a deprecated object +DEV: development tool or utility +DOC: documentation +ENH: enhancement +MNT: maintenance commit (refactoring, typos, etc.) +REV: revert an earlier commit +STY: style fix (whitespace, PEP8) +TST: addition or modification of tests +REL: related to releases +``` +## The Pull Request + +* Now push to your fork +* Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. This is a start to the conversation. + +At this point you're waiting on us. We like to at least comment on pull requests within three business days +(and, typically, one business day). We may suggest some changes or improvements or alternatives. + +Hints to make the integration of your changes easy (and happen faster): +- Keep your pull requests small +- Don't forget your unit tests +- All algorithms need documentation, don't forget the .rst file +- Don't take changes requests to change your code personally diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..532087a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. + +## Context + + + +## Your Environment + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5b0292c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? + + + + + diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 0000000..25dabb3 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,26 @@ +name: Check Code Style + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + + - name: Install flake8 + shell: bash -l {0} + run: | + set -vxeuo pipefail + python -m pip install --upgrade pip + python -m pip install flake8 + python -m pip list + + - name: Run flake8 + shell: bash -l {0} + run: flake8 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..af0af8e --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,46 @@ +name: Unit Tests + +on: + push: + pull_request: + schedule: + - cron: '00 4 * * *' # daily at 4AM + +jobs: + build: + runs-on: ubuntu-latest + services: + mongodb: + image: mongo + ports: + - 27017:27017 + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + fail-fast: false + steps: + + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install + shell: bash -l {0} + run: source continuous_integration/scripts/install.sh + + - name: Install test requirements + shell: bash -l {0} + run: | + set -vxeuo pipefail + python -m pip install -r requirements-test.txt + python -m pip list + + - name: Test with pytest + shell: bash -l {0} + run: | + set -vxeuo pipefail + coverage run -m pytest -v + coverage report diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ea0aa14..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: python -python: - - 3.6 -cache: - directories: - - $HOME/.cache/pip - - $HOME/.ccache # https://github.com/travis-ci/travis-ci/issues/5853 -services: - - mongodb - -install: - # Install this package and the packages listed in requirements.txt. - - pip install . - # Install extra requirements for running tests and building docs. - - pip install -r requirements-dev.txt - -script: - - coverage run -m pytest # Run the tests and check for test coverage. - - coverage report -m # Generate test coverage report. - - codecov # Upload the report to codecov. - - flake8 # Enforce code style. - - make -C docs html # Build the documentation. diff --git a/README.md b/README.md index 9bd1a1b..1da1459 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # suitcase.mongo +[![Build Status](https://img.shields.io/github/workflow/status/bluesky/suitcase-mongo/Unit%20Tests)](https://github.com/bluesky/suitcase-mongo/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster) + This is a suitcase subpackage for inserting bluesky documents into MongoDB. It contains two packages: diff --git a/continuous_integration/scripts/install.sh b/continuous_integration/scripts/install.sh new file mode 100644 index 0000000..04479c0 --- /dev/null +++ b/continuous_integration/scripts/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -vxeuo pipefail + +# These packages are installed in the base environment but may be older +# versions. Explicitly upgrade them because they often create +# installation problems if out of date. +python -m pip install --upgrade pip setuptools wheel numpy +# Versioneer uses the most recent git tag to generate __version__, which appears +# in the published documentation. +git fetch --tags +python -m pip install . +python -m pip list