Skip to content

Commit 732079b

Browse files
committed
ci: update workflows
1 parent 7d77791 commit 732079b

File tree

5 files changed

+33
-39
lines changed

5 files changed

+33
-39
lines changed

.github/workflows/comment-bot.yml

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
name: Comment Bot
22
on:
3-
issue_comment:
4-
types: [created]
5-
pull_request_review_comment:
6-
types: [created]
3+
issue_comment: {types: [created]}
4+
pull_request_review_comment: {types: [created]}
75
jobs:
86
tag: # /tag <tagname> <commit>
97
if: startsWith(github.event.comment.body, '/tag ')
108
runs-on: ubuntu-latest
119
steps:
12-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
1311
- name: React Seen
14-
uses: actions/github-script@v2
12+
uses: actions/github-script@v6
1513
with:
1614
script: |
17-
const perm = await github.repos.getCollaboratorPermissionLevel({
15+
const perm = await github.rest.repos.getCollaboratorPermissionLevel({
1816
owner: context.repo.owner, repo: context.repo.repo,
1917
username: context.payload.comment.user.login})
2018
post = (context.eventName == "issue_comment"
21-
? github.reactions.createForIssueComment
22-
: github.reactions.createForPullRequestReviewComment)
19+
? github.rest.reactions.createForIssueComment
20+
: github.rest.reactions.createForPullRequestReviewComment)
2321
if (!["admin", "write"].includes(perm.data.permission)){
2422
post({
2523
owner: context.repo.owner, repo: context.repo.repo,
@@ -40,12 +38,12 @@ jobs:
4038
BODY: ${{ github.event.comment.body }}
4139
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
4240
- name: React Success
43-
uses: actions/github-script@v2
41+
uses: actions/github-script@v6
4442
with:
4543
script: |
4644
post = (context.eventName == "issue_comment"
47-
? github.reactions.createForIssueComment
48-
: github.reactions.createForPullRequestReviewComment)
45+
? github.rest.reactions.createForIssueComment
46+
: github.rest.reactions.createForPullRequestReviewComment)
4947
post({
5048
owner: context.repo.owner, repo: context.repo.repo,
5149
comment_id: context.payload.comment.id, content: "rocket"})

.github/workflows/test.yml

+20-25
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: Test
22
on:
33
push:
44
pull_request:
5-
schedule:
6-
- cron: '15 23 * * 6' # M H d m w (Sat at 23:15)
5+
schedule: [{cron: '15 23 * * 6'}] # M H d m w (Sat at 23:15)
76
jobs:
87
check:
98
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
109
runs-on: ubuntu-latest
1110
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-python@v4
13+
with:
14+
python-version: '3.x'
1415
- name: set PYSHA
1516
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
16-
- uses: actions/cache@v1
17+
- uses: actions/cache@v3
1718
with:
1819
path: ~/.cache/pre-commit
1920
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
@@ -42,10 +43,10 @@ jobs:
4243
matrix:
4344
python: [2.7, 3.6, 3.9]
4445
steps:
45-
- uses: actions/checkout@v2
46+
- uses: actions/checkout@v3
4647
with:
4748
fetch-depth: 0
48-
- uses: actions/setup-python@v2
49+
- uses: actions/setup-python@v4
4950
with:
5051
python-version: ${{ matrix.python }}
5152
- run: pip install -U .[dev,nii,web]
@@ -62,14 +63,14 @@ jobs:
6263
matrix:
6364
python: [3.7, 3.9]
6465
steps:
65-
- uses: actions/checkout@v2
66+
- uses: actions/checkout@v3
6667
with:
6768
fetch-depth: 0
6869
- name: Run setup-python
6970
run: setup-python -p${{ matrix.python }}
7071
- run: pip install -U .[dev,nii,cuda,web,mbeautify]
7172
- run: pytest --durations-min=1
72-
- uses: codecov/codecov-action@v1
73+
- uses: codecov/codecov-action@v3
7374
- name: Post Run setup-python
7475
run: setup-python -p${{ matrix.python }} -Dr
7576
if: ${{ always() }}
@@ -78,10 +79,12 @@ jobs:
7879
name: PyPI Deploy
7980
runs-on: ubuntu-latest
8081
steps:
81-
- uses: actions/checkout@v2
82+
- uses: actions/checkout@v3
8283
with:
8384
fetch-depth: 0
84-
- uses: actions/setup-python@v2
85+
- uses: actions/setup-python@v4
86+
with:
87+
python-version: '3.x'
8588
- id: dist
8689
uses: casperdcl/deploy-pypi@v2
8790
with:
@@ -90,19 +93,11 @@ jobs:
9093
gpg_key: ${{ secrets.GPG_KEY }}
9194
password: ${{ secrets.PYPI_TOKEN }}
9295
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
93-
- id: meta
94-
name: Changelog
95-
run: |
96-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
97-
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
9896
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
99-
uses: softprops/action-gh-release@v1
97+
name: Release
98+
run: |
99+
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
100+
tag="${GITHUB_REF#refs/tags/}"
101+
gh release create --title "miutil $tag beta" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} dist/${{ steps.dist.outputs.whl_asc }}
100102
env:
101-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
102-
with:
103-
name: miutil ${{ steps.meta.outputs.tag }} beta
104-
body_path: _CHANGES.md
105-
draft: true
106-
files: |
107-
dist/${{ steps.dist.outputs.whl }}
108-
dist/${{ steps.dist.outputs.whl_asc }}
103+
GH_TOKEN: ${{ github.token }}

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To install extras and their dependencies,
4242
use the package name ``miutil[option1,option2]``.
4343

4444

45-
.. |Tests| image:: https://img.shields.io/github/workflow/status/AMYPAD/miutil/Test?logo=GitHub
45+
.. |Tests| image:: https://img.shields.io/github/actions/workflow/status/AMYPAD/miutil/test.yml?branch=master&logo=GitHub
4646
:target: https://github.com/AMYPAD/miutil/actions
4747
.. |Coverage| image:: https://codecov.io/gh/AMYPAD/miutil/branch/master/graph/badge.svg
4848
:target: https://codecov.io/gh/AMYPAD/miutil

miutil/fdio.py

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def extractall(fzip, dest, desc="Extracting"):
7878

7979
def nsort(fnames):
8080
"""Sort a file list, automatically detecting embedded numbers"""
81-
8281
def path2parts(fname):
8382
parts = re.split(r"([0-9][0-9.]*e[-+][0-9]+|[0-9]+\.[0-9]+|[0-9]+)", fname)
8483
parts[1::2] = map(float, parts[1::2])

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ each_dict_entry_on_separate_line=False
8282
space_between_ending_comma_and_closing_bracket=False
8383
split_before_named_assigns=False
8484
split_before_closing_bracket=False
85+
blank_line_before_nested_class_or_def=False
8586

8687
[isort]
8788
profile=black
8889
line_length=99
90+
multi_line_output=4
8991
known_first_party=miutil,tests
9092

9193
[tool:pytest]

0 commit comments

Comments
 (0)