Skip to content

Commit

Permalink
Update format and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewGardhouse committed Jan 20, 2025
1 parent 98b93a1 commit b5eb954
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 16 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,31 @@ on:
- pull_request

jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
sf: ${{ steps.filter.outputs.sf }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
sf:
- pennylane_sf/**
- tests/**
- .pylintrc
- Makefile
- requirements-ci.txt
- requirements.txt
- setup.py
black:
needs: changes
if: ${{ needs.changes.outputs.sf == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: dorny/paths-filter@v3
Expand Down
40 changes: 24 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@ on:
pull_request:

jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
sf: ${{ steps.filter.outputs.sf }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
sf:
- pennylane_sf/**
- tests/**
- .pylintrc
- Makefile
- requirements-ci.txt
- requirements.txt
- setup.py
tests:
needs: changes
if: ${{ needs.changes.outputs.sf == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -21,34 +45,18 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
sf:
- pennylane_sf/**
- tests/**
- .pylintrc
- Makefile
- requirements-ci.txt
- requirements.txt
- setup.py
- name: Install dependencies
if: steps.filter.outputs.sf == 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock --upgrade
- name: Install Plugin
if: steps.filter.outputs.sf == 'true'
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
- name: Run tests
if: steps.filter.outputs.sf == 'true'
run: python -m pytest tests --cov=pennylane_sf --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native
- name: Upload coverage to Codecov
if: steps.filter.outputs.sf == 'true'
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml

0 comments on commit b5eb954

Please sign in to comment.