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/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cc705d0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + branches: [ master ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + 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 + cp .env.sample .env + + - name: Run tests + run: | + chmod +x $GITHUB_WORKSPACE/scripts/run_tests.sh + sh $GITHUB_WORKSPACE/scripts/run_tests.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