tipresias/candystore

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: build

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
    env:
      CC_TEST_REPORTER_ID: d60734b9fc6663df40df650f2867d005e145acd5f741f34505a5e405f79ea784
    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 dependencies
        run: |
          python -m pip install --upgrade pip
          pip3 install -r requirements.txt
      - name: Set up CodeClimate
        # Only do test coverage on latest version of Python to avoid duplication
        if: ${{ matrix.python-version }} == 3.8
        run: |
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./cc-test-reporter before-build
      - name: Lint
        if: ${{ always() }}
        run: pylint --disable=R candystore tests
      - name: Check types
        if: ${{ always() }}
        run: mypy candystore tests
      - name: Check documentation
        if: ${{ always() }}
        run: pydocstyle candystore
      - name: Check formatting
        if: ${{ always() }}
        run: black candystore tests --check
      - name: Run tests
        if: ${{ always() }}
        run: coverage run -m pytest tests/unit
      - name: Upload test coverage report
        # Only do test coverage on latest version of Python to avoid duplication
        if: ${{ matrix.python-version }} == 3.9
        run: |
          coverage xml
          ./cc-test-reporter format-coverage -t coverage.py
          ./cc-test-reporter upload-coverage
  integration:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build the docker image
        run: docker build -t candystore_tests .
      - name: Run integration tests
        run: ./scripts/integration_tests.sh