From 7d8cc9277aedf252b7a4fe1e8a3c965915137a27 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Fri, 15 Jan 2021 14:26:07 +0200 Subject: [PATCH] ci: only conditionally run python tests --- .github/workflows/python-package.yml | 13 +++++++++++++ pyhtzee/scoring.py | 1 + scripts/ci_skip_python.sh | 17 +++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100755 scripts/ci_skip_python.sh diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b9a99ef..be58190 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,22 +19,35 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Check if python changes are present + id: check + env: + GITHUB_REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + continue-on-error: true + run: ./scripts/ci_skip_python.sh - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 + if: steps.check.outcome == 'failure' with: python-version: ${{ matrix.python-version }} - name: Install dependencies + if: steps.check.outcome == 'failure' run: | python -m pip install -r requirements.txt - name: Lint with black + if: steps.check.outcome == 'failure' run: | black --check --target-version py38 setup.py pyhtzee tests - name: Lint with flake8 + if: steps.check.outcome == 'failure' run: | flake8 . --count --show-source --statistics - name: Lint with mypy + if: steps.check.outcome == 'failure' run: | mypy --ignore-missing-imports . - name: Test with pytest + if: steps.check.outcome == 'failure' run: | pytest tests/*.py diff --git a/pyhtzee/scoring.py b/pyhtzee/scoring.py index 2f421c9..01d3c28 100644 --- a/pyhtzee/scoring.py +++ b/pyhtzee/scoring.py @@ -1,3 +1,4 @@ +# asdf """ Scoring functions for lists with five dice. All functions (except upper sectino bonus) are given a a list of ints representing the number of dots on the face. If the list of diff --git a/scripts/ci_skip_python.sh b/scripts/ci_skip_python.sh new file mode 100755 index 0000000..97c4ab7 --- /dev/null +++ b/scripts/ci_skip_python.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +URL="https://api.github.com/repos/${GITHUB_REPO}/pulls/${PR_NUMBER}/files" +FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename') + +cat<