Heiss/py-datatype-redis

View on GitHub
.github/workflows/test-and-build.yml

Summary

Maintainability
Test Coverage
name: Redis container testing environment
on: push

jobs:
  test:
    name: coverage
    runs-on: ubuntu-latest
    # Service containers to run with `container-job`
    services:
      # Label used to access the service container
      redis:
        # Docker Hub image
        image: redis
        # Set health checks to wait until redis has started
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          # Maps port 6379 on service container to the host
          - 6379:6379
    steps:
      - uses: actions/checkout@master
      - uses: actions/setup-python@master
        with:
          python-version: "3.6"
      - uses: paambaati/codeclimate-action@v2.5.3
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CodeClimate }}
          # The hostname used to communicate with the Redis service container
          REDIS_HOST: localhost
          # The default Redis port
          REDIS_PORT: 6379
        with:
          coverageCommand: make test

  build-n-publish:
    needs: test
    name: Build and publish Python distributions to PyPI
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@master
      - name: Set up Python 3.6
        uses: actions/setup-python@v1
        with:
          python-version: 3.6
      - name: Install dependencies
        run: python3 -m pip install --user --upgrade setuptools wheel twine
      - name: Build source
        run: python3 setup.py sdist bdist_wheel
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@master
        with:
          user: __token__
          password: ${{ secrets.pypi_password }}