-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to poetry #19
base: master
Are you sure you want to change the base?
Switch to poetry #19
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,48 +7,31 @@ on: | |
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.6'] | ||
|
||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Include tags in the checkout | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Get Pip cache directory | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ hashFiles('**/setup.py') }}-pip-cache | ||
restore-keys: | | ||
${{ runner.os }}-pip-cache | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade setuptools wheel twine | ||
python-version: 3.6 | ||
|
||
- name: Install poetry | ||
uses: dschep/[email protected] | ||
|
||
- name: Publish vcap | ||
working-directory: ./vcap | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
PRE_RELEASE_SUFFIX=$(python3 ../.github/workflows/pre_release_suffix.py) \ | ||
python3 setup.py sdist bdist_wheel | ||
python3 -m twine upload dist/* | ||
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ | ||
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: poetry publish | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you haven't already, would you mind testing this pipeline with Test PyPI to make sure all is well? To do that, you have to set these environment variables:
and then add |
||
|
||
- name: Publish vcap-utils | ||
working-directory: ./vcap_utils | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
PRE_RELEASE_SUFFIX=$(python3 ../.github/workflows/pre_release_suffix.py) \ | ||
python3 setup.py sdist bdist_wheel | ||
python3 -m twine upload dist/* | ||
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ | ||
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: poetry publish |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,42 +10,48 @@ jobs: | |
test: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Include tags in the checkout | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Get Pip cache directory | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ hashFiles('**/setup.py') }}-pip-cache | ||
restore-keys: | | ||
${{ runner.os }}-pip-cache | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Include tags in the checkout | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
|
||
- name: Install poetry | ||
uses: dschep/[email protected] | ||
|
||
- name: Configure poetry for caching | ||
run: | | ||
# https://github.com/dschep/install-poetry-action/issues/11 | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project false | ||
poetry config cache-dir ~/.poetry | ||
poetry config virtualenvs.path ~/.poetry/virtualenv | ||
|
||
- name: Cache poetry virtualenv | ||
uses: actions/cache@v2 | ||
id: poetry-cache | ||
with: | ||
path: ~/.poetry | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
pip install -e "./vcap[easy,tests]" | ||
pip install -e "./vcap_utils[tests]" | ||
working-directory: ./vcap_utils | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This grabs the PyPI version of vcap. Undesirable, but now sure how to proceed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it work to run something like |
||
run: poetry install -E easy | ||
|
||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics | ||
|
||
- name: Test with pytest | ||
run: | | ||
pytest | ||
run: pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this job is still set up to run for every commit on master, but I think that would make this CI fail unless we always bump the vcap and vcap_utils versions for every commit since PyPI doesn't let you overwrite versions. Should it instead run only when there's a git tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poetry has a
version
command. So you can dopoetry version minor
and it bumps the version in the toml.Is this something we could integrate into the CI?