diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a4661f5..8f22d66 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,8 +36,21 @@ jobs: - name: build documents run: make -C doc html + - name: Run tests and upload coverage + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10776d3..a56262f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,17 +44,12 @@ jobs: conda activate test conda install --file requirements/run.txt conda install --file requirements/test.txt - pip install -e . - + pip install . + - name: Validate diffpy.structure shell: bash -l {0} run: | conda activate test - coverage run -m diffpy.structure.tests.run + coverage run -m pytest -vv -s coverage report -m codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..f2ff7e4 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + pre-commit: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files