Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Release workflow #145

Merged
merged 42 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0e4d6ae
[CI] Changed pre-release to build.yml
igiloh-pinecone Oct 31, 2023
cd4f22d
TEMP! rename back
igiloh-pinecone Oct 31, 2023
67e13bf
[CI] build - upload all wheels
igiloh-pinecone Oct 31, 2023
531b2e5
[CI] Single build, multiple test
igiloh-pinecone Oct 31, 2023
043cb0d
[CI] Install dependencies before wheel
igiloh-pinecone Oct 31, 2023
168664e
[CI] Activate in every run
igiloh-pinecone Oct 31, 2023
1998e0f
Merge remote-tracking branch 'origin/dev' into release_workflow
igiloh-pinecone Nov 1, 2023
0c0335e
[CI] Trying to download artifacts from build flow
igiloh-pinecone Nov 1, 2023
fb7d559
[CI] TEMP! made release workflow run on push
igiloh-pinecone Nov 1, 2023
96f612d
TEMP! trying to add version
igiloh-pinecone Nov 1, 2023
c55c5d5
missing ./
igiloh-pinecone Nov 1, 2023
43d17f4
[CI] wrong key
igiloh-pinecone Nov 1, 2023
611f634
[CI] Build in the main release job, download in test job
igiloh-pinecone Nov 1, 2023
278be8c
[CI] Added publish job
igiloh-pinecone Nov 1, 2023
eaf0bd1
TEMP! try to debug
igiloh-pinecone Nov 1, 2023
e330a8a
Try name
igiloh-pinecone Nov 1, 2023
82c8e66
Try input
igiloh-pinecone Nov 1, 2023
f2a6d75
Try manual patch
igiloh-pinecone Nov 1, 2023
150476e
bugfix - typo
igiloh-pinecone Nov 1, 2023
0d4ebdd
[CI] Bug fix - there's only one `wheels` file
igiloh-pinecone Nov 1, 2023
1a3f3b7
[CI] Try re-set version
igiloh-pinecone Nov 1, 2023
2afb1b8
[CI] Try job with needs
igiloh-pinecone Nov 2, 2023
6805965
try env
igiloh-pinecone Nov 2, 2023
c51dab9
[CI] Try outputs
igiloh-pinecone Nov 2, 2023
d795bbb
[CI] Try hardcoded version
igiloh-pinecone Nov 2, 2023
9abe72b
Try using env
igiloh-pinecone Nov 2, 2023
6671598
use the right tag
igiloh-pinecone Nov 2, 2023
eef9246
Added basic CHANGELOG
igiloh-pinecone Nov 2, 2023
7693075
[CI] Use changelog + try release pypi
igiloh-pinecone Nov 2, 2023
b946a41
Merge branch 'rename_library' into release_workflow
igiloh-pinecone Nov 2, 2023
a8f13d8
Try without pypi
igiloh-pinecone Nov 2, 2023
9fda8e3
Try pypi again
igiloh-pinecone Nov 2, 2023
64b65d7
Debug poetry publish
igiloh-pinecone Nov 2, 2023
fd652a4
[CI] use proper name for download
igiloh-pinecone Nov 2, 2023
24c8a45
[CI] proper test-pypi
igiloh-pinecone Nov 2, 2023
11a184f
[CI] Fix testpypi
igiloh-pinecone Nov 2, 2023
7d4b915
fix testpypi again
igiloh-pinecone Nov 2, 2023
d9a420d
Merge remote-tracking branch 'origin/dev' into release_workflow
igiloh-pinecone Nov 6, 2023
3dc636b
[CI] Try with different GH release action + pypi token
igiloh-pinecone Nov 6, 2023
86cecba
[CI] Made bump optional + enabled test-pypi as option
igiloh-pinecone Nov 6, 2023
88bdca1
[CI] Commit version change only if version was bumped
igiloh-pinecone Nov 6, 2023
7042301
[CI] Revert setting virtualenvs-create to false
igiloh-pinecone Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions .github/workflows/pre-release-CI.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Pre Release CI
name: Build and Test installation

on:
workflow_dispatch:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build & Test on ${{ matrix.os }}-py${{ matrix.python-version }}
test-installation:
name: Test on ${{ matrix.os }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -31,30 +32,35 @@ jobs:
uses: snok/install-poetry@v1
with:
version: 1.3.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Build wheel
- name: Download wheels
uses: actions/download-artifact@v2
with:
name: wheels
path: ./dist/

- name: Install dev dependencies
run: |
poetry build
poetry install --no-root --only dev --no-interaction

- name: Install the wheel
run: |
source $VENV
pip install dist/pinecone_canopy*.whl

- name: Create dev requirements file
run: |
poetry export -f requirements.txt --without-hashes --only dev -o only-dev.txt

- name: Install dev requirements
- name: Run unit tests
run: |
pip install -r only-dev.txt

- name: Run tests
run: pytest --html=report.html --self-contained-html tests/unit
source $VENV
pytest --html=report.html --self-contained-html tests/unit

- name: Upload pytest reports
if: always()
if: failure()
uses: actions/upload-artifact@v3
with:
name: pytest-report-${{ matrix.os }}-py${{ matrix.python-version }}
path: .pytest_cache


143 changes: 143 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: 'Release'

on:
workflow_dispatch:
inputs:
bumpVersion:
description: 'Whether to bump the version number'
required: true
type: boolean
default: true
versionLevel:
description: 'Which version level to bump'
required: true
type: choice
default: 'patch'
options:
- 'patch' # bug fixes
- 'minor' # new features, backwards compatible
- 'major' # breaking changes
generateBranch:
description: 'Whether to generate a release branch'
required: true
type: boolean
default: false
useTestPyPI:
description: 'Whether to use the test PyPI repository'
required: true
type: boolean
default: false


jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.store-version.outputs.new_version }}

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9 # The lowest we support

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2

- name: Bump version
if: ${{ inputs.bumpVersion == true }}
run: |
poetry version ${{ inputs.releaseLevel || 'patch' }}

- name: Store version number
id: store-version
run: |
echo "new_version=$(poetry version -s)" >> $GITHUB_OUTPUT

- name: Build wheel
run: |
poetry build

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/

test-all-OSes:
needs: build
uses: ./.github/workflows/pre-release-CI.yml

publish:
needs: [build, test-all-OSes]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2

- name: download wheels
uses: actions/download-artifact@v2
with:
name: wheels
path: ./dist/

- name: Set version
env:
NEW_VERSION: ${{ needs.store-version.outputs.new_version }}
run: |
echo $NEW_VERSION
poetry version $NEW_VERSION

- name: Commit version update
if: ${{ inputs.bumpVersion == true }}
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
git add pyproject.toml
git commit -m "Bump version to $(poetry version -s)"
git push

- name: Create release branch
if: ${{ github.event_name == 'workflow_dispatch' && inputs.generateBranch == 'true' }}
run: |
git checkout -b release/$(poetry version -s)
git push origin release/$(poetry version -s)

- name: Create GH release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: V${{ needs.build.outputs.new_version }}
name: ${{ needs.build.outputs.new_version }}
artifacts: "dist/*"
bodyFile: "CHANGELOG.md"

- name: Publish to test pypi
if: ${{ inputs.useTestPyPI == 'true' }}
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
poetry publish -r testpypi

- name: Publish to pypi
if: ${{ inputs.useTestPyPI == 'false' }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [0.1.0] - 2023-10-05

- Initial release