kengz/SLM-Lab

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.7

      - uses: liskin/gh-problem-matcher-wrap@v1
        with:
          action: add
          linters: flake8

      - name: Lint with flake8
        shell: bash -l {0}
        run: |
          pip install flake8
          # exit-zero treats all errors as warnings.
          flake8 . --ignore=E501 --exit-zero --statistics

      - uses: liskin/gh-problem-matcher-wrap@v1
        with:
          action: remove
          linters: flake8

  build:
    needs: lint
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache Conda
        uses: actions/cache@v2
        env:
          # change from default size of 32MB to prevent 503 err
          CACHE_UPLOAD_CHUNK_SIZE: 67108864
        with:
          path: /usr/share/miniconda/envs/lab
          key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }}
          restore-keys: |
            ${{ runner.os }}-conda-

      - name: Setup Conda dependencies
        uses: conda-incubator/setup-miniconda@v2
        with:
          activate-environment: lab
          environment-file: environment.yml
          python-version: 3.7
          auto-activate-base: false

      - name: Conda info
        shell: bash -l {0}
        run: |
          conda info
          conda list

      - uses: liskin/gh-problem-matcher-wrap@v1
        with:
          action: add
          linters: pytest

      - name: Run tests
        shell: bash -l {0}
        run: |
          python setup.py test

      - uses: liskin/gh-problem-matcher-wrap@v1
        with:
          action: add
          linters: pytest

      - name: Test & publish code coverage
        uses: paambaati/codeclimate-action@v2.7.5
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}