MauriceBrg/lambda_bundler

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Lambda-Bundler-Build

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

  # Trigger on release, this will cause the upload to Pypi
  release:
    types:
      - created

jobs:

  cross_platform_tests:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest] 
        pythonVersion: ["3.6", "3.7", "3.8"]
    
      fail-fast: true
    
    steps:
      - name: Checkout 
        uses: actions/checkout@v2
      
      - name: Install Python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.pythonVersion }}
      
      - name: Install dev dependencies
        run: pip install -e ".[dev]"
      
      - name: Run Tests
        run: pytest

  build_python_package:
    runs-on: ubuntu-latest
    needs: cross_platform_tests

    steps:

      # - name: Show Event
      #   run: |
      #     echo $GITHUB_EVENT_PATH
      #     cat $GITHUB_EVENT_PATH

      - name: Checkout 
        uses: actions/checkout@v2
      
      - name: Install Python 3.6
        uses: actions/setup-python@v2
        with:
          python-version: 3.6
      
      - name: Install dev dependencies
        run: pip install -e ".[dev]"
      
      # - name: Run Pytest
      #   run: pytest --cov-report=xml

      - name: Upload coverage metrics
        uses: paambaati/codeclimate-action@v2.6.0
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_COVERAGE_REPORT}}
        with:
          coverageCommand: pytest --cov-report=xml
          coverageLocations: |
            ${{github.workspace}}/coverage.xml:coverage.py

      # - name: Upload coverage metrics
      #   uses: codecov/codecov-action@v1
      #   with:
      #     fail_ci_if_error: true
      
      - name: Run Pylint
        run: pylint lambda_bundler
      
      - name: Create distribution 📦
        run: python3 setup.py sdist bdist_wheel
      
      - name: Publish artifact
        uses: actions/upload-artifact@v2
        with:
          name: python-packages
          path: dist/
    
      - name: Publish distribution 📦 to PyPI
        if: startsWith(github.ref, 'refs/tags')
        uses: pypa/gh-action-pypi-publish@master
        with:
          password: ${{ secrets.PYPI_LAMBDA_BUNDLER_TOKEN }}