From 39ec7eb24dd3b74d8d62fbbe36bd6c5b36d30fcb Mon Sep 17 00:00:00 2001 From: Edward Runkel Date: Fri, 18 Sep 2020 10:44:06 -0400 Subject: [PATCH] Create coverage.yml, and add upload_coverage script --- .github/workflows/coverage.yml | 35 ++++++++++++++++++++++++++++++++++ scripts/upload_coverage.sh | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 scripts/upload_coverage.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..d453edc --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: [ master ] + +jobs: + generate-and-upload-coverage: + runs-on: ubuntu-latest + + if: github.event.pull_request.merged == true + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + + - name: Run setup + run: | + python3 -m pip install -r requirements.txt + python3 -m pip install -r requirements-dev.txt + + - name: Generate coverage + run: | + chmod +x $GITHUB_WORKSPACE/scripts/generate_coverage.sh + sh $GITHUB_WORKSPACE/scripts/generate_coverage.sh + + - name: Upload coverage + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + run: | + chmod +x $GITHUB_WORKSPACE/scripts/upload_coverage.sh + sh $GITHUB_WORKSPACE/scripts/upload_coverage.sh + diff --git a/scripts/upload_coverage.sh b/scripts/upload_coverage.sh new file mode 100644 index 0000000..26c8f93 --- /dev/null +++ b/scripts/upload_coverage.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml