[pre-commit.ci] pre-commit autoupdate #471
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: Test and Deploy | |
on: [pull_request, push] | |
jobs: | |
tests: | |
env: | |
ENV_NAME: tests | |
PYTHON: ${{ matrix.python-version }} | |
OS: ${{ matrix.os }} | |
name: Testing | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.8, 3.9, "3.10"] | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: python -m pip install .[tests] | |
- name: Run Tests | |
run: | | |
python -m pytest --cov=pspec_likelihood --cov-config=.coveragerc --cov-report xml:./coverage.xml --durations=25 | |
- uses: codecov/codecov-action@v3 | |
if: matrix.os == 'ubuntu-latest' && success() | |
with: | |
file: ./coverage.xml #optional | |
deploy: | |
needs: tests | |
# Only run this job if new work is pushed to "main" | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# Step 1. Set up operating system | |
runs-on: ubuntu-latest | |
steps: | |
# Step 2. Set up Python 3.9 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Step 3. Check-out repository so we can access its contents | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# Step 4. Use PSR to make release | |
- name: Python Semantic Release | |
run: | | |
python -m pip install python-semantic-release | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release publish | |
# Step 5. Publish to TestPyPI | |
- name: Publish 📦 to Test PyPI | |
if: ${{ !contains(github.ref, 'main') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
# Step 6. Test install from TestPyPI | |
- name: Test install from TestPyPI | |
run: | | |
python -m pip install \ | |
--index-url https://test.pypi.org/simple/ \ | |
--extra-index-url https://pypi.org/simple \ | |
pspec_likelihood | |
# Step 7. Publish to PyPI | |
- name: Publish 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} |