Reduce Docker image size (#30) #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Unit Test via Pytest | |
on: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
jobs: | |
lint-and-test: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write | |
checks: write | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v3 | |
- name: Install dependencies | |
run: pdm install | |
- name: Lint with black | |
uses: psf/black@stable | |
with: | |
options: "--check --verbose" | |
- name: Test with pytest | |
run: | | |
pdm run pytest --junit-xml=test-results.xml | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
test-results.xml | |
- name: Test with coverage | |
run: | | |
pdm run coverage run -m pytest -v -s | |
- name: Generate Coverage Report | |
run: | | |
pdm run coverage report -m | |
- name: Coverage comment | |
id: coverage_comment | |
uses: py-cov-action/python-coverage-comment-action@v3 | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Store Pull Request comment to be posted | |
uses: actions/upload-artifact@v3 | |
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | |
with: | |
name: python-coverage-comment-action | |
path: python-coverage-comment-action.txt |