Use build-and-inspect-python-package action (#10722)
This uses https://github.com/hynek/build-and-inspect-python-package to ensure our package is correct, both during testing and deploy,
This commit is contained in:
		
							parent
							
								
									7a829cb57d
								
							
						
					
					
						commit
						27165cf8db
					
				| 
						 | 
					@ -28,25 +28,30 @@ jobs:
 | 
				
			||||||
        fetch-depth: 0
 | 
					        fetch-depth: 0
 | 
				
			||||||
        persist-credentials: false
 | 
					        persist-credentials: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Set up Python
 | 
					    - name: Build and Check Package
 | 
				
			||||||
      uses: actions/setup-python@v4
 | 
					      uses: hynek/build-and-inspect-python-package@v1.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Download Package
 | 
				
			||||||
 | 
					      uses: actions/download-artifact@v3
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        python-version: "3.7"
 | 
					        name: Packages
 | 
				
			||||||
 | 
					        path: dist
 | 
				
			||||||
    - name: Install dependencies
 | 
					 | 
				
			||||||
      run: |
 | 
					 | 
				
			||||||
        python -m pip install --upgrade pip
 | 
					 | 
				
			||||||
        pip install --upgrade build tox
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: Build package
 | 
					 | 
				
			||||||
      run: |
 | 
					 | 
				
			||||||
        python -m build
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Publish package to PyPI
 | 
					    - name: Publish package to PyPI
 | 
				
			||||||
      uses: pypa/gh-action-pypi-publish@release/v1
 | 
					      uses: pypa/gh-action-pypi-publish@release/v1
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        password: ${{ secrets.pypi_token }}
 | 
					        password: ${{ secrets.pypi_token }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Set up Python
 | 
				
			||||||
 | 
					      uses: actions/setup-python@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        python-version: "3.7"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Install tox
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        python -m pip install --upgrade pip
 | 
				
			||||||
 | 
					        pip install --upgrade tox
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Publish GitHub release notes
 | 
					    - name: Publish GitHub release notes
 | 
				
			||||||
      env:
 | 
					      env:
 | 
				
			||||||
        GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
 | 
					        GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,11 @@ on:
 | 
				
			||||||
env:
 | 
					env:
 | 
				
			||||||
  PYTEST_ADDOPTS: "--color=yes"
 | 
					  PYTEST_ADDOPTS: "--color=yes"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Cancel running jobs for the same workflow and branch.
 | 
				
			||||||
 | 
					concurrency:
 | 
				
			||||||
 | 
					  group: ${{ github.workflow }}-${{ github.ref }}
 | 
				
			||||||
 | 
					  cancel-in-progress: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set permissions at the job level.
 | 
					# Set permissions at the job level.
 | 
				
			||||||
permissions: {}
 | 
					permissions: {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -189,3 +194,10 @@ jobs:
 | 
				
			||||||
        fail_ci_if_error: true
 | 
					        fail_ci_if_error: true
 | 
				
			||||||
        files: ./coverage.xml
 | 
					        files: ./coverage.xml
 | 
				
			||||||
        verbose: true
 | 
					        verbose: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  check-package:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - uses: actions/checkout@v3
 | 
				
			||||||
 | 
					    - name: Build and Check Package
 | 
				
			||||||
 | 
					      uses: hynek/build-and-inspect-python-package@v1.5
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,3 +114,8 @@ template = "changelog/_template.rst"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[tool.black]
 | 
					[tool.black]
 | 
				
			||||||
target-version = ['py37']
 | 
					target-version = ['py37']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# check-wheel-contents is executed by the build-and-inspect-python-package action.
 | 
				
			||||||
 | 
					[tool.check-wheel-contents]
 | 
				
			||||||
 | 
					# W009: Wheel contains multiple toplevel library entries
 | 
				
			||||||
 | 
					ignore = "W009"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue