Skip to content

Commit

Permalink
👷 Run all tests only on PR, 1 otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
Baharis committed Oct 16, 2024
1 parent cba1b20 commit e4a69d3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 56 deletions.
50 changes: 0 additions & 50 deletions .github/actions/tests/action.yml

This file was deleted.

40 changes: 34 additions & 6 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,42 @@ jobs:
- name: Check-out repository
uses: actions/checkout@v4

- name: apparently we are lost
run: echo $(ls)

- name: Run tests, linting, coverage, docs check
uses: ./.github/actions/tests
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
representative: ${{ matrix.representative }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install --with dev

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
echo "Linting errors in picometer/tests:"
poetry run flake8 ./picometer --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 ./tests --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
echo "Linting warnings in picometer/tests:"
poetry run flake8 ./picometer --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
poetry run flake8 ./tests --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Test with pytest
run: poetry run pytest tests/ --cov=picometer --cov-report=xml

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v4
if: ${{ matrix.representative }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml # coverage report

- name: Build documentation
run: poetry run make html --directory docs/
if: ${{ matrix.representative }}

CD:
# Only run this job if the "CI" job passes
Expand Down

0 comments on commit e4a69d3

Please sign in to comment.