Update build-qa.yml #980
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rosey the Robot | |
on: [push, pull_request, release] | |
jobs: | |
build: | |
name: Quality Check | |
runs-on: Ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.6 | |
- name: Install Requirements and Dependencies | |
run: | | |
pip install --upgrade pip setuptools | |
pip install -e .[test] | |
- name: Prepare Environment | |
run: | | |
rm -rf .coverage | |
coverage erase | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: Run Tests and Generate Coverage Results | |
run: | | |
pytest --cov=pkt_kg --cov-report xml:coverage.xml | |
coverage report | |
coverage xml | |
python-codacy-coverage -r coverage.xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
- name: Linting with Mypy | |
run: mypy --strict-optional pkt_kg | |
- name: Sonar Cloud Scanner | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Codacy | |
uses: codacy/codacy-coverage-reporter-action@master | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: coverage.xml | |
- name: Code Climate | |
uses: paambaati/codeclimate-action@v2.7.5 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
- name: Coveralls | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# publish_docker_container: | |
# if: github.event_name == 'push' | |
# needs: build | |
# name: Push Docker Image to Docker Hub | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Set-up QEMU | |
# uses: docker/setup-qemu-action@v2 | |
# - name: Set-up Docker Buildx | |
# uses: docker/setup-buildx-action@v2 | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Build and Push Container to DockerHub | |
# id: docker_build | |
# uses: docker/build-push-action@v4 | |
# with: | |
# push: true | |
# tags: callahantiff/pheknowlator:latest | |
# - name: Image Digest | |
# run: echo ${{ steps.docker_build.outputs.digest }} | |
publish_pypi_library: | |
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') | |
needs: build | |
name: Publishes pkt_kg to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.6 | |
- name: Install Requirements and Dependencies | |
run: pip install --upgrade pip setuptools wheel | |
- name: Create Package Distribution | |
run: python setup.py sdist bdist_wheel | |
- name: Publish Package to PyPi | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
skip_existing: true |