Skip to content

Commit 2ef0b90

Browse files
Refactor contribution process + Stop supporting Python 3.5 (#219)
* #218 Introduce Poetry * #218 Add contribution guide * #218 Migrate to travis to GithubActions with poetry * #218 Stop supporting Python 3.6 and refactor build&publish process * #218 Update poetry lock * #218 Add more github actions * #218 Github Actions
1 parent 929c600 commit 2ef0b90

16 files changed

+1234
-132
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Generate changelog
2+
on:
3+
release:
4+
types: [created, edited]
5+
6+
jobs:
7+
generate-changelog:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
- uses: BobAnkh/auto-generate-changelog@master
14+
with:
15+
REPO_NAME: 'BobAnkh/auto-generate-changelog'
16+
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
17+
PATH: '/CHANGELOG.md'
18+
COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
19+
TYPE: 'feat:Feature,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Create Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
releaseversion:
6+
description: 'Specify release version (e.g. 2.0.1)'
7+
required: true
8+
default: ''
9+
jobs:
10+
create-release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Replace Versions
14+
run: |
15+
sed -i "s/^version = .*$/version = \"${{github.event.inputs.releaseversion}}\"/g" pyproject.toml
16+
sed -i "s/^__version__ = .*$/__version__ = \"${{github.event.inputs.releaseversion}}\"/g" atcodertools/release_management/version.py
17+
- name: Make sure diff exists
18+
run: |
19+
git diff --stat --exit-code atcodertools/release_management/version.py
20+
git diff --stat --exit-code pyproject.toml
21+
- uses: EndBug/[email protected]
22+
with:
23+
author_name: github-actions
24+
author_email: 41898282+github-actions[bot]@users.noreply.github.com
25+
26+
- name: Create Release
27+
id: create_release
28+
uses: actions/create-release@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
tag_name: ${{ github.event.inputs.releaseversion }}
33+
release_name: Release ${{ github.event.inputs.releaseversion }}
34+
body: |
35+
Release version ${{ github.event.inputs.releaseversion }}
36+
draft: false
37+
prerelease: false

.github/workflows/nosetests.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/stylecheck.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Check no style violation
2+
3+
on:
4+
push:
5+
branches: [ stable ]
6+
pull_request:
7+
branches: [ stable ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Python 3.6
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.6
20+
21+
- name: Install Poetry
22+
run: |
23+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
24+
25+
- name: Add path for Poetry
26+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
27+
28+
- name: Install Dependencies
29+
run: poetry install --no-interaction
30+
31+
- name: Check styles
32+
run: |
33+
poetry run flake8 --ignore=E501,W503,W605 --exclude=atcodertools/tools/templates/,tests/resources/test_codegen/ atcodertools tests
34+
poetry run autopep8 -r . --exclude 'default_template.py,test_codegen' --diff | tee check_autopep8
35+
test ! -s check_autopep8

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run unit tests & integration tests
2+
3+
on:
4+
push:
5+
branches: [ stable ]
6+
pull_request:
7+
branches: [ stable ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [ 3.6, 3.8 ]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install Poetry
25+
run: |
26+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
27+
28+
- name: Add path for Poetry
29+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
30+
31+
- name: Install Dependencies
32+
run: poetry install --no-interaction
33+
34+
# Install Compilers for integration tests
35+
- name: Install D compiler
36+
uses: dlang-community/setup-dlang@v1
37+
with:
38+
compiler: dmd-latest
39+
40+
- name: Install other compilers
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install nim mono-complete
44+
45+
- name: Run Unit Tests and Integration Tests
46+
run: |
47+
poetry run atcoder-tools gen arc050 --without-login
48+
poetry run nosetests tests --exe -v --with-coverage --cover-package=atcodertools
49+
poetry run codecov
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Python 3.6
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.6
18+
19+
- name: Install Poetry
20+
run: |
21+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
22+
23+
- name: Add path for Poetry
24+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
25+
26+
- name: Install Dependencies
27+
run: poetry install --no-interaction
28+
- name: Build and publish
29+
env:
30+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
31+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
32+
run: |
33+
rm -rf dist/
34+
poetry build
35+
poetry run twine upload --repository-url https://test.pypi.org/legacy/ dist/*
36+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ debug.py
1010
atcoder_tools.egg-info/
1111
build/
1212
dist/
13+
check_autopep8

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
_Sorry for non-Japanese readers, but currently the English version of the contribution guide is unavailable although your contribution is welcome.
2+
In the meanwhile, please try machine translation or ask [@kyuridenamida](https://twitter.com/kyuridenamida) directly on Twitter for the contribution guideline._
3+
4+
# コントリビューションガイド
5+
6+
AtCoderToolsへのコントリビューションに興味を持って頂きありがとうございます。このガイドの目的は2つです。
7+
8+
- コードの品質を保ち、メンテナンスコストを下げ、少ない労力で継続的な開発を行っていくためのお願いをお伝えすること
9+
- 開発者が機能追加・修正に対して何をしたら良いかを明らかにすること。
10+
11+
不明瞭な部分があったらissueを立てて報告してください。あなたのフィードバックはいつでも歓迎です。
12+
13+
## 開発環境のセットアップ
14+
15+
### 1. 適切なPythonバージョンを用意
16+
17+
ユーザーの環境にpython 3.6以降がインストールされていることを想定しています。
18+
それらは各自で各々インストールしてください。
19+
20+
### 2. Poetryを通じたパッケージにインストール
21+
依存ライブラリのインストールはpoetryを通じて行います。
22+
poetryのインストールはhttps://cocoatomo.github.io/poetry-ja/ を参照してください。
23+
24+
プロジェクトのルートディレクトリで以下のコマンドを実行することで環境がインストールできます。
25+
```
26+
poetry install
27+
```
28+
29+
## 開発フロー
30+
31+
少し注文が多いですが、メンテナ一人で継続的にメンテナンスしていくためには開発者の皆様に以下のことをお願いすることが必要不可欠です。
32+
どうかご理解いただけると幸いです。
33+
34+
### 1. フォークする
35+
36+
https://github.com/kyuridenamida/atcoder-tools を開き、右上のForkボタンでatcoder-toolsをforkしてください。
37+
38+
### 2. 実装をする
39+
40+
気をつけてほしいことは現状2つです。
41+
42+
- 変更範囲を不必要に大きくしない。 2つの独立した変更を一緒くたに行うことは避ける。
43+
- コマンドの下位互換性を大切にする。難しい場合はIssue等で相談してください。
44+
- 過去のconfigが動くこと
45+
- 過去のコマンドが動くこと
46+
47+
複雑な機能については実装前にめissue等でデザインを相談していただくと手戻りコストが少ないかもしれません。
48+
49+
### 3. テストを書く
50+
51+
特に理由が無い場合Lineカバレッジ 100% を要求します。
52+
またバグの修正の場合も、バグが修正されたことを確認するテストを書いてください。
53+
54+
### 4. ドキュメントを書く
55+
新しいコマンドラインパラメータやConfigの場合、README.mdにドキュメントを書いてください。
56+
57+
### 5. Linterをかける
58+
自動整形や不要なインポートを静的チェックします。
59+
60+
### 6. ユニットテストが通ることを確認する
61+
TODO: ここ
62+
63+
### 7. Commitする + Pushする
64+
65+
このプロジェクトにおいてのコミットメッセージの規約は以下の通りです。
66+
- 英語で書く
67+
68+
変更をCommitしてPushします。できるだけ英語だと嬉しいです。
69+
実装とテストのコミットが複数あっても構いませんし細かいことは気にしません。
70+
71+
### 8. プルリクエストを送る
72+
73+
変更内容の概要を書いてください。英語で書いてくれると嬉しいですが、日本語とその機械翻訳の結果とかでもいいです。
74+
概要はテンプレートに従うと楽ですが、必要に応じて独自の書き方でも構いません。
75+
少なくとも
76+
77+
- なぜこの変更が必要か? (簡潔なもので良い)
78+
- 何をしたか? (コードを読む際に手助けになる程度で良い)
79+
- どういう挙動が期待されるか? (メンテナが手元で動作チェックする時に必要)
80+
81+
を書いてくださると嬉しいです。
82+
83+
### 9. ビルドが通ったバッジが緑色になっていることを確認する
84+
85+
### 10. @kyuridenamidaからレビューを受ける
86+
@kyuridenamidaが頑張ってレビューをします。
87+
88+
申し訳ないですが、機能によっては必ずマージされるわけではないです。
89+
少しでもatcoder-toolsの責務じゃないと思ったら事前に相談してくれると嬉しいです。
90+
91+
### 11. マージされる
92+
不定期です。
93+
94+
### 12. リリースされる。
95+
おめでとうございます。あなたの機能はリリースされました。

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)