Skip to content

Commit 356be32

Browse files
authored
Add workflow to release Copulas on PyPI (#467)
1 parent cf59b06 commit 356be32

File tree

10 files changed

+138
-58
lines changed

10 files changed

+138
-58
lines changed

.github/workflows/end_to_end.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
- os: macos-latest
1919
python-version: '3.13'
2020
steps:
21-
- uses: actions/checkout@v1
21+
- uses: actions/checkout@v4
2222
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v5
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
- name: Install dependencies

.github/workflows/lint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
lint:
1014
runs-on: ubuntu-latest
1115
steps:
12-
- uses: actions/checkout@v1
16+
- uses: actions/checkout@v4
1317
- name: Set up Python 3.9
14-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1519
with:
1620
python-version: 3.9
1721
- name: Install dependencies

.github/workflows/minimum.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
minimum:
1014
runs-on: ${{ matrix.os }}
@@ -18,9 +22,9 @@ jobs:
1822
- os: macos-latest
1923
python-version: '3.13'
2024
steps:
21-
- uses: actions/checkout@v1
25+
- uses: actions/checkout@v4
2226
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v5
2428
with:
2529
python-version: ${{ matrix.python-version }}
2630
- name: Install dependencies

.github/workflows/numerical.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
unit:
1014
runs-on: ${{ matrix.os }}
@@ -18,9 +22,9 @@ jobs:
1822
- os: macos-latest
1923
python-version: '3.13'
2024
steps:
21-
- uses: actions/checkout@v1
25+
- uses: actions/checkout@v4
2226
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v5
2428
with:
2529
python-version: ${{ matrix.python-version }}
2630
- name: Install dependencies

.github/workflows/readme.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
readme:
1014
runs-on: ${{ matrix.os }}
@@ -13,9 +17,9 @@ jobs:
1317
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1418
os: [ubuntu-latest, macos-latest]
1519
steps:
16-
- uses: actions/checkout@v1
20+
- uses: actions/checkout@v4
1721
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v5
1923
with:
2024
python-version: ${{ matrix.python-version }}
2125
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
workflow_dispatch:
8+
inputs:
9+
candidate:
10+
description: 'Release candidate.'
11+
required: true
12+
type: boolean
13+
default: true
14+
test_pypi:
15+
description: 'Test PyPi.'
16+
type: boolean
17+
default: false
18+
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
ref: ${{ inputs.candidate && 'main' || 'stable' }}
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.13'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
python -m pip install .[dev]
36+
37+
- name: Create wheel
38+
run: |
39+
make dist
40+
41+
- name: Publish a Python distribution to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
password: ${{ inputs.test_pypi && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
45+
repository-url: ${{ inputs.test_pypi && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
46+
47+
- name: Bump version to next candidate
48+
if: ${{ inputs.candidate && !inputs.test_pypi }}
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
52+
make bumpversion-candidate
53+
make git-push

.github/workflows/tutorials.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
tutorials:
1014
runs-on: ubuntu-latest
1115
strategy:
1216
matrix:
1317
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1418
steps:
15-
- uses: actions/checkout@v1
19+
- uses: actions/checkout@v4
1620
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v5
1822
with:
1923
python-version: ${{ matrix.python-version }}
2024
- name: Install package and dependencies

.github/workflows/unit.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
unit:
1014
runs-on: ${{ matrix.os }}
@@ -18,9 +22,9 @@ jobs:
1822
- os: macos-latest
1923
python-version: '3.13'
2024
steps:
21-
- uses: actions/checkout@v1
25+
- uses: actions/checkout@v4
2226
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v5
2428
with:
2529
python-version: ${{ matrix.python-version }}
2630
- name: Install dependencies

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ check-release: check-clean check-candidate check-main check-history ## Check if
252252

253253
.PHONY: release
254254
release: check-release git-merge-main-stable bumpversion-release git-push-tags-stable \
255-
publish git-merge-stable-main bumpversion-patch git-push
255+
git-merge-stable-main bumpversion-patch git-push
256256

257257
.PHONY: release-test
258258
release-test: check-release git-merge-main-stable bumpversion-release bumpversion-revert

RELEASE.md

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,21 @@ The process of releasing a new version involves several steps:
88

99
3. [Documentation](#documentation)
1010

11-
4. [Milestone](#milestone)
11+
4. [Make a release candidate](#make-a-release-candidate)
1212

13-
5. [HISTORY.md](#history.md)
13+
5. [Integration with SDV](#integration-with-sdv)
1414

15-
6. [Distribution](#distribution)
15+
6. [Milestone](#milestone)
1616

17-
7. [Integration with SDV](#integration-with-sdv)
17+
7. [HISTORY.md](#history.md)
1818

19-
7.1. [Install SDV from source](#install-sdv-from-source)
19+
8. [Distribution](#distribution)
2020

21-
7.2. [Install from distribution](#install-from-distribution)
21+
9. [Making the release](#making-the-release)
2222

23-
7.3. [Run SDV tests and README.md examples](#run-sdv-tests-and-readme.md-examples)
23+
9.1. [Tag and release to PyPi](#tag-and-release-to-pypi)
2424

25-
8. [Making the release](#making-the-release)
26-
27-
8.1. [Tag and release to PyPi](#tag-and-release-to-pypi)
28-
29-
8.2. [Update the release on GitHub](#update-the-release-on-github)
25+
9.2. [Update the release on GitHub](#update-the-release-on-github)
3026

3127

3228
## Install Copulas from source
@@ -94,6 +90,44 @@ Alternatively, you can simply generate the documentation using the command:
9490
make docs
9591
```
9692

93+
## Make a release candidate
94+
95+
1. On the Copulas GitHub page, navigate to the [Actions][actions] tab.
96+
2. Select the `Release` action.
97+
3. Run it on the main branch. Make sure `Release candidate` is checked and `Test PyPi` is not.
98+
4. Check on [PyPi][copulas-pypi] to assure the release candidate was successfully uploaded.
99+
100+
[actions]: https://github.com/sdv-dev/Copulas/actions
101+
[copulas-pypi]: https://pypi.org/project/copulas/#history
102+
103+
## Integration with SDV
104+
105+
### Create a branch on SDV to test the candidate
106+
107+
Before doing the actual release, we need to test that the candidate works with SDV. To do this, we can create a branch on SDV that points to the release candidate we just created using the following steps:
108+
109+
1. Create a new branch on the SDV repository.
110+
111+
```bash
112+
git checkout -b test-copulas-X.Y.Z
113+
```
114+
115+
2. Update the pyproject.toml to set the minimum version of Copulas to be the same as the version of the release. For example,
116+
117+
```toml
118+
'copulas>=X.Y.Z.dev0'
119+
```
120+
121+
3. Push this branch. This should trigger all the tests to run.
122+
123+
```bash
124+
git push --set-upstream origin test-copulas-X.Y.Z
125+
```
126+
127+
4. Check the [Actions][sdv-actions] tab on SDV to make sure all the tests pass.
128+
129+
[sdv-actions]: https://github.com/sdv-dev/SDV/actions
130+
97131
## Milestone
98132

99133
It's important check that the git hub and milestone issues are up to date with the release.
@@ -174,37 +208,6 @@ pip install /path/to/copulas/dist/<copulas-distribution-version-any>.whl
174208

175209
4. Now you are ready to execute the README.md examples.
176210

177-
## Integration with SDV
178-
179-
### Install SDV from source
180-
181-
Clone the project and install the development requirements. Alternatively, with your virtualenv activated.
182-
183-
```bash
184-
git clone https://github.com/sdv-dev/SDV
185-
cd SDV
186-
git checkout main
187-
make install-develop
188-
```
189-
190-
### Install from distribution
191-
192-
Install the Copulas version from the generated distribution file.
193-
194-
```bash
195-
pip install /path/to/copulas/dist/<copulas-distribution-version-any>.whl
196-
```
197-
198-
### Run SDV tests and README.md examples
199-
200-
Execute the SDV tests to ensure that the new distribution version works.
201-
202-
```bash
203-
make test
204-
```
205-
206-
Also, execute the SDV README.md examples.
207-
208211
## Making the release
209212

210213
At the end, we need to make the release. First, check if the release can be made:

0 commit comments

Comments
 (0)