Skip to content

docs(clv): align MAP vs MCMC comparison in quickstart (#2575) #7645

docs(clv): align MAP vs MCMC comparison in quickstart (#2575)

docs(clv): align MAP vs MCMC comparison in quickstart (#2575) #7645

Workflow file for this run

name: PyPI
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
should_build: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- ".github/workflows/pypi.yml"
- "pyproject.toml"
- "pymc_marketing/**"
build:
needs: changes
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.should_build == 'true' }}
name: build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build the sdist and the wheel
run: |
pip install build
python -m build
- name: Check the sdist installs and imports
run: |
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install ../dist/pymc_marketing*.tar.gz
echo "Checking import and version number (on release)"
venv-sdist/bin/python -c "import pymc_marketing as pmm; assert pmm.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else pmm.__version__; print(pmm.__version__)"
cd ..
- name: Check the bdist installs and imports
run: |
mkdir -p test-bdist
cd test-bdist
python -m venv venv-bdist
venv-bdist/bin/python -m pip install ../dist/pymc_marketing*.whl
echo "Checking import and version number (on release)"
venv-bdist/bin/python -c "import pymc_marketing as pmm; assert pmm.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else pmm.__version__; print(pmm.__version__)"
cd ..
- uses: actions/upload-artifact@v7
with:
name: artifact
path: dist/*
build_status:
if: ${{ always() }}
name: build source distribution check
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check build status
if: ${{ !contains(fromJSON('["success", "skipped"]'), needs.build.result) }}
run: exit 1
test:
permissions:
id-token: write
name: upload to test PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v8
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Test pip install from test.pypi
run: |
python -m venv venv-test-pypi
venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pymc-marketing
echo "Checking import and version number"
venv-test-pypi/bin/python -c "import pymc_marketing; assert pymc_marketing.__version__ == '${{ github.ref_name }}'"
publish:
environment: release
permissions:
id-token: write
name: upload release to PyPI
needs: [build, test]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v8
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1