Skip to content

Add SoftmaxWeightedSumFitter for synthetic control #1999

Add SoftmaxWeightedSumFitter for synthetic control

Add SoftmaxWeightedSumFitter for synthetic control #1999

Workflow file for this run

name: PyPI release
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
permissions: {}
jobs:
build:
name: Build source distribution
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11
- name: Build the sdist and the wheel
run: |
pip install build
python -m build
ls dist # List the contents of the dist directory
- 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/causalpy*.tar.gz
echo "Checking import and version number (on release)"
venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${REF_NAME}' if '${REF_TYPE}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
cd ..
env:
REF_NAME: ${{ github.ref_name }}
REF_TYPE: ${{ github.ref_type }}
- 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/causalpy*.whl
echo "Checking import and version number (on release)"
venv-bdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${REF_NAME}' if '${REF_TYPE}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
cd ..
env:
REF_NAME: ${{ github.ref_name }}
REF_TYPE: ${{ github.ref_type }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: artifact
path: dist/*
test:
name: Upload to Test PyPI
permissions:
id-token: write
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
skip_existing: true
repository_url: https://test.pypi.org/legacy/
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11
- name: Test pip install from test.pypi
run: |
# Give time to test.pypi to update its index. If we don't wait,
# we might request to install before test.pypi is aware that it actually has the package
sleep 5s
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 causalpy
echo "Checking import and version number"
venv-test-pypi/bin/python -c "import causalpy; assert causalpy.__version__ == '${REF_NAME}'"
env:
REF_NAME: ${{ 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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0