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 8, 2022
2 parents 45e51c7 + 1ab5557 commit 04457f6
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 746 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.14"
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.14",
"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
24 changes: 12 additions & 12 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ inputs:
poetry_version:
description: The Poetry version.
required: false
default: '1.1.14'
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: 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 @@ -20,7 +20,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 @@ -30,7 +30,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 @@ -43,18 +45,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
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,13 +11,16 @@ lint:
@poetry run pylint ./pureskillgg_csgo_dsdk
@poetry run black --check .

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

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

watch:
@poetry run ptw

.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 test watch version
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,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/csgo-dsdk/actions?query=workflow%3Aversion

GitHub Actions
Expand Down
Loading

0 comments on commit 04457f6

Please sign in to comment.