From 2f669cb7d74160b5a647788260763f7e042de9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Lilleb=C3=B8=20Gundersen?= Date: Mon, 31 May 2021 09:04:00 +0200 Subject: [PATCH] Add test workflow --- .github/workflows/test.yml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ec74f8f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: test + +on: + pull_request_target: + pull_request: + push: + branches: + - master + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/pip + ~/.cache/pre-commit + key: ${{ runner.os }}-pip-2 + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - run: python -m pip install pre-commit + - run: pre-commit run --all-files + test: + needs: linting + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10.0-beta.1" ] + pytest-version: [ "4", "5", "6" ] + steps: + - name: Check out repository + uses: actions/checkout@v2 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Pytest ${{ matrix.pytest-version }} and pytest-cov + run: pip install pytest==${{ matrix.pytest-version }} pytest-cov + - name: Install package + run: pip install -e . + - name: Run tests + run: | + pytest --cov=pytest_diff --verbose --assert=plain + coverage report