Skip to content

Commit

Permalink
Merge remote-tracking branch 'makenew/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Oct 9, 2022
2 parents fbd02f2 + 5857237 commit 252e209
Show file tree
Hide file tree
Showing 15 changed files with 808 additions and 923 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG VARIANT="3"

FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}

ARG POETRY_VERSION="1.1.13"
ARG POETRY_VERSION="1.2.1"
ARG POETRY_SRC="https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py"

USER vscode
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"POETRY_VERSION": "1.1.13",
"POETRY_VERSION": "1.2.1",
"VARIANT": "3.9"
}
},
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ indent_size = 2
indent_size = 4

[Makefile]
indent_style = tabs
indent_style = tab
27 changes: 15 additions & 12 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@ inputs:
poetry_version:
description: The Poetry version.
required: false
default: '1.1.13'
default: '1.2.1'

runs:
using: composite
steps:
- name: Setup Python
uses: actions/setup-python@v4
- name: Setup Poetry cache
uses: actions/cache@v3
with:
python-version: ${{ inputs.python_version }}
path: ~/.local
key: poetry-${{ inputs.poetry_version }}
- name: Setup Poetry
uses: gr1n/setup-poetry@v7
uses: snok/install-poetry@v1
with:
poetry-version: ${{ inputs.poetry_version }}
- name: Setup cache
uses: actions/cache@v3
version: ${{ inputs.poetry_version }}
- name: Setup Python
uses: actions/setup-python@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
cache: poetry
python-version: ${{ inputs.python_version }}
- name: Check lockfile
shell: bash
run: poetry lock --check
- name: Install dependencies
shell: bash
run: poetry install
run: poetry install --sync
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
fix:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Test
run: make test
lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Lint
run: make lint
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ on:

jobs:
pypi:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: make build
- name: Publish
run: make publish
run: poetry publish --build --skip-existing -u $USERNAME -p $PASSWORD
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
USERNAME: __token__
PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
19 changes: 5 additions & 14 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: version

run-name: ${{ github.event.inputs.version }}${{ github.event.client_payload.version }}

on:
workflow_dispatch:
inputs:
Expand All @@ -12,7 +14,7 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
Expand Down Expand Up @@ -42,18 +44,7 @@ jobs:
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Lint
run: make lint
- name: Test
run: make test
- name: Build
run: make build
- name: Cut ${{ github.event.inputs.version }}${{ github.event.client_payload.version }} version
run: |
version="${{ github.event.inputs.version }}${{ github.event.client_payload.version }}"
if [[ "${version}" =~ [0-9] ]]; then
poetry run bump2version --sign-tags --new-version $version major
else
poetry run bump2version --sign-tags $version
fi
git push && git push --tags
poetry version "${{ github.event.inputs.version }}${{ github.event.client_payload.version }}"
make version
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.12
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: lint test
all: build

build:
@rm -rf dist
Expand All @@ -11,9 +11,6 @@ lint:
@poetry run pylint ./pureskillgg_makenew_pyskill
@poetry run black --check .

publish:
@poetry run twine upload --skip-existing dist/*

test:
@poetry run pytest --cov=./pureskillgg_makenew_pyskill

Expand All @@ -23,4 +20,10 @@ watch:
notebook:
@poetry run jupyter notebook notebooks

.PHONY: build docs test
version:
@git add pyproject.toml
@git commit -m "$$(poetry version -s)"
@git tag --sign "v$$(poetry version -s)" -m "$(poetry version -s)"
@git push --follow-tags

.PHONY: build format lint notebook test watch version
13 changes: 6 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ Bootstrapping a New Project
::

$ poetry install
$ poetry run bump2version patch
$ git push
$ git push --tags
$ poetry version patch
$ make version

Updating
~~~~~~~~
Expand Down Expand Up @@ -286,14 +285,14 @@ Run tests on changes with
Publishing
~~~~~~~~~~

Use the bump2version_ command to release a new version.
Push the created git tag which will trigger a GitHub action.

.. _bump2version: https://github.com/c4urself/bump2version
Use the `poetry version`_ command to release a new version.
Then run `make version` to commit and push a new git tag
which will trigger a GitHub action.

Publishing may be triggered using on the web
using a `workflow_dispatch on GitHub Actions`_.

.. _Poetry version: https://python-poetry.org/docs/cli/#version
.. _workflow_dispatch on GitHub Actions: https://github.com/pureskillgg/makenew-pyskill/actions?query=workflow%3Aversion

GitHub Actions
Expand Down
2 changes: 1 addition & 1 deletion makenew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ makenew () {

git rm -rf notebooks/tutorial pureskillgg_makenew_pyskill/tutorial

sed_delete README.rst '18,201d'
sed_delete README.rst '18,200d'
sed_insert README.rst '18i' 'TODO'

old_title="PureSkill.gg PySkill Skeleton"
Expand Down
Loading

0 comments on commit 252e209

Please sign in to comment.