Skip to content
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

hato-botの差分反映 #2634

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 9 additions & 8 deletions .github/workflows/pr-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ jobs:
# submodule: 'recursive'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
id: setup_python
- name: Get uv version
id: get_uv_version
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: echo "uv_version=$(sed -e 's/uv==//g' requirements.txt)" >> "$GITHUB_OUTPUT"
- name: Set up uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
python-version-file: .python-version
cache: pipenv
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: sed -i -e "s/python_version = \".*\"/python_version = \"$(echo ${{ steps.setup_python.outputs.python-version }} | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/g')\"/g" Pipfile
version: ${{steps.get_uv_version.outputs.uv_version}}
enable-cache: true
- name: Install dependencies
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/pipenv_install.sh"
run: bash "${GITHUB_WORKSPACE}/scripts/uv_install.sh"
# formatする
# --exit-codeをつけることで、autopep8内でエラーが起きれば1、差分があれば2のエラーステータスコードが返ってくる。正常時は0が返る
- name: Format files
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ jobs:
with:
submodules: "recursive"
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: Get uv version
id: get_uv_version
run: echo "uv_version=$(sed -e 's/uv==//g' requirements.txt)" >> "$GITHUB_OUTPUT"
- name: Set up uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
with:
python-version-file: .python-version
cache: pipenv
- name: Install pipenv
run: bash "${GITHUB_WORKSPACE}/scripts/pipenv_install.sh"
version: ${{steps.get_uv_version.outputs.uv_version}}
enable-cache: true
- name: Install uv
run: bash "${GITHUB_WORKSPACE}/scripts/uv_install.sh"
- name: Set venv path
env:
DEST_PATH: "/home/runner/work/_temp/_github_workflow/.venv"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-update-readme-sudden-death.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: sed -i -e "s/Python [0-9.]*/Python $(cat .python-version)/g" README.md
run: sed -i -e "s/Python [0-9.]*/Python $(yq '.project.requires-python' pyproject.toml | sed -e 's/==//g')/g" README.md
- uses: dev-hato/actions-diff-pr-management@8d475e5bc78f61c40024d4859b79134b66f788d2 # v1.2.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

1 change: 0 additions & 1 deletion .python-version

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include Pipfile
include pyproject.toml
21 changes: 0 additions & 21 deletions Pipfile

This file was deleted.

228 changes: 0 additions & 228 deletions Pipfile.lock

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
## Requirements

- Python 3.13.1
- `pipenv install`
- `uv sync`
- `npm install`

## Usage

sd.pyを実行することで次に入力した文字が吹き出しになって出力されます。また、同時に出力された吹き出しはクリップボードにもコピーされます。

```sh
pipenv run python sd.py メッセージ
uv run sd.py メッセージ
```

## lintをかける方法
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"lint": "npm run lint:markdown && npm run lint:text && npm run lint:python && npm run lint:python-type && npm run lint:secret",
"lint:markdown": "markdownlint -c .markdown-lint.yml -i node_modules .",
"lint:text": "textlint -c .textlintrc $(find . -name '*.md' | grep -v node_modules)",
"lint:python": "pipenv run pylint --rcfile .python-lint *.py",
"lint:python-type": "pipenv run mypy --config-file .mypy.ini --install-types --non-interactive *.py",
"lint:python": "uv tool run pylint --rcfile .python-lint *.py",
"lint:python-type": "uv tool run mypy --config-file .mypy.ini --install-types --non-interactive *.py",
"lint:secret": "docker run --rm --platform=linux/amd64 -v $(pwd):/path -w /path zricethezav/gitleaks protect --verbose --redact"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "sudden_death"
version = "0.0.1"
description = "突然の死(ハリフキダシ)を生成するツール"
requires-python = "==3.13.1"
dependencies = [ "click==8.1.7", "pyperclip>=1.5.27",]

[dependency-groups]
dev = [ "autopep8==2.3.1", "pylint==3.3.2", "mypy==1.13.0", "flake8==7.1.1", "importlib-metadata==8.5.0", "toml==0.10.2", "types-toml==0.10.8.20240310", "setuptools==75.6.0", "toml==0.10.2",]

[tool.uv]
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pipenv==2024.4.0
uv==0.5.9
5 changes: 0 additions & 5 deletions scripts/pipenv_install.sh

This file was deleted.

8 changes: 3 additions & 5 deletions scripts/pr_copy_ci_sudden_death/pr_copy_ci/copy_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ for f in $(find hato-bot/scripts -type f | grep -v hato_bot | sed -e "s:hato-bot
cp "hato-bot/${f}" "sudden-death/${f}"
done

for f in .markdown-lint.yml .python-lint .textlintrc .gitleaks.toml .mypy.ini .pre-commit-config.yaml .python-version .pep8 .flake8 .python-black .isort.cfg .prettierignore renovate.json requirements.txt; do
for f in .markdown-lint.yml .python-lint .textlintrc .gitleaks.toml .mypy.ini .pre-commit-config.yaml .pep8 .flake8 .python-black .isort.cfg .prettierignore renovate.json requirements.txt; do
rm -f "sudden-death/${f}"
cp hato-bot/${f} sudden-death/
done
PATTERN_BEFORE="$(grep '^click' sudden-death/Pipfile)"
PATTERN_AFTER="$(grep '^click' hato-bot/Pipfile)"
PATTERN="s/${PATTERN_BEFORE}/${PATTERN_AFTER}/g"
sed -i -e "${PATTERN}" sudden-death/Pipfile
PATTERN_AFTER="$(grep click hato-bot/pyproject.toml | sed -e 's/^.*click==\([0-9.]*\)".*$/\1/g')"
sed -i -e "s/click==[0-9.]*\"/click==${PATTERN_AFTER}\"/g" sudden-death/pyproject.toml
Loading
Loading