Skip to content

Commit

Permalink
Merge branch 'release/2.0.0a2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Konano committed Jan 27, 2022
2 parents fbd9675 + b81378c commit f875e39
Show file tree
Hide file tree
Showing 73 changed files with 3,494 additions and 2,156 deletions.
71 changes: 71 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: "2" # required to adjust maintainability checks

checks:
argument-count:
enabled: true
config:
threshold: 4
complex-logic:
enabled: true
config:
threshold: 4
file-lines:
enabled: true
config:
threshold: 250
method-complexity:
enabled: true
config:
threshold: 5
method-count:
enabled: true
config:
threshold: 20
method-lines:
enabled: true
config:
threshold: 25
nested-control-flow:
enabled: true
config:
threshold: 4
return-statements:
enabled: true
config:
threshold: 4
similar-code:
enabled: true
config:
threshold: #language-specific defaults. overrides affect all languages.
identical-code:
enabled: true
config:
threshold: #language-specific defaults. overrides affect all languages.

plugins:
bandit:
enabled: true
checks:
assert_used:
enabled: false
blacklist:
enabled: false
subprocess_without_shell_equals_true:
enabled: false
pep8:
enabled: true
checks:
E501:
enabled: false
sonar-python:
enabled: true
checks:
python:S1871:
enabled: false
python:S125:
enabled: false

exclude_patterns:
- "arknights_mower/data/*.py"
- "**/*.png"
- "arknights_mower/ocr/*.py"
27 changes: 27 additions & 0 deletions .github/git-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# git hooks

## Install

```bash
git config core.hooksPath `git rev-parse --show-toplevel`/.github/git-hooks
```

## git commit 提交规范

参考:https://www.conventionalcommits.org/zh-hans/v1.0.0-beta.4/

- build: Changes that affect the build system or external dependencies.
- chore: Others.
- ci: Changes to our CI configuration files and scripts.
- docs: Documentation only changes.
- feat: A new feature.
- fix: A bug fix.
- hotfix: Publish a hotfix.
- perf: A code change that improves performance.
- refactor: A code change that neither fixes a bug or adds a feature.
- release: Publish a new release.
- revert: Revert the last commit.
- style: Changes that do not affect the meaning of the code.
- test: Adding missing tests or correcting existing tests.
- update: Data updates.
- workflow: Changes to our workflow configuration files and scripts.
18 changes: 18 additions & 0 deletions .github/git-hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# https://www.conventionalcommits.org/zh-hans/v1.0.0-beta.4/

COMMIT_MESSAGE=`cat $1`
COMMIT_RE="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|release|hotfix|workflow|update)(\(.+\))?: .{1,100}"
MERGE_RE="^Merge "

if [[ ! $COMMIT_MESSAGE =~ $COMMIT_RE ]] && [[ ! $COMMIT_MESSAGE =~ $MERGE_RE ]]
then
echo "Illegal commit message format:"
echo $COMMIT_MESSAGE
echo ""
echo "Please use the correct format."
exit 1
fi

exit 0
18 changes: 18 additions & 0 deletions .github/gitflow-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# git-flow hooks

## Install

```bash
git config gitflow.path.hooks `git rev-parse --show-toplevel`/.github/gitflow-hooks
```

## git-flow config

- Branch name for production releases: `main`
- Branch name for "next release" development: `dev`
- Feature branch prefix: `feature/`
- Bugfix branch prefix: `bugfix/`
- Release branch prefix: `release/`
- Hotfix branch prefix: `hotfix/`
- Support branch prefix: `support/`
- Version tag prefix: `v`
28 changes: 28 additions & 0 deletions .github/gitflow-hooks/filter-flow-hotfix-start-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Runs during git flow hotfix start
#
# Positional arguments:
# $1 Version
#
# Return VERSION - When VERSION is returned empty, git-flow will stop as the
# version is necessary
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
# VERSION=$1

VERSION=$1
VERSION_RE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(a[1-9][0-9]*)?$"
if [[ ! $VERSION =~ $VERSION_RE ]]
then
# echo "Illegal version format: $VERSION"
exit 1
fi

# Return the VERSION
echo $VERSION
exit 0
28 changes: 28 additions & 0 deletions .github/gitflow-hooks/filter-flow-release-start-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Runs during git flow release start
#
# Positional arguments:
# $1 Version
#
# Return VERSION - When VERSION is returned empty, git-flow will stop as the
# version is necessary
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
# VERSION=$1

VERSION=$1
VERSION_RE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(a[1-9][0-9]*)?$"
if [[ ! $VERSION =~ $VERSION_RE ]]
then
# echo "Illegal version format: $VERSION"
exit 1
fi

# Return the VERSION
echo $VERSION
exit 0
26 changes: 26 additions & 0 deletions .github/gitflow-hooks/pre-flow-hotfix-finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Runs at the end of git flow hotfix start
#
# Positional arguments:
# $1 The version (including the version prefix)
# $2 The origin remote
# $3 The full branch name (including the hotfix prefix)
# $4 The base from which this hotfix is started
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
# VERSION=$1
# ORIGIN=$2
# BRANCH=$3
# BASE=$4

ROOT=`git rev-parse --show-toplevel`
VERSION=${1:1}

sed -i "s/__version__ = '[0-9\.a]\+'/__version__ = '$VERSION'/g" "$ROOT/arknights_mower/__init__.py"
git add "$ROOT/arknights_mower/__init__.py"
git commit -m "hotfix: v$VERSION"
26 changes: 26 additions & 0 deletions .github/gitflow-hooks/pre-flow-release-finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Runs at the end of git flow release start
#
# Positional arguments:
# $1 The version (including the version prefix)
# $2 The origin remote
# $3 The full branch name (including the release prefix)
# $4 The base from which this release is started
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
# VERSION=$1
# ORIGIN=$2
# BRANCH=$3
# BASE=$4

ROOT=`git rev-parse --show-toplevel`
VERSION=${1:1}

sed -i "s/__version__ = '[0-9\.a]\+'/__version__ = '$VERSION'/g" "$ROOT/arknights_mower/__init__.py"
git add "$ROOT/arknights_mower/__init__.py"
git commit -m "release: v$VERSION"
48 changes: 48 additions & 0 deletions .github/workflows/pyinstaller-win-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Windows Binary Package (Alpha)

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'

jobs:
build-win-amd64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Set up Python 3.9 amd64
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Install dependencies
shell: cmd
run: |
python -m pip install --upgrade pip
python -m venv venv64
venv64\Scripts\python -m pip install --upgrade pip wheel setuptools
venv64\Scripts\python -m pip install -r requirements.txt
venv64\Scripts\python -m pip install pyinstaller
- name: Make package
shell: cmd
run: |
venv64\Scripts\pyinstaller .\main.spec --onefile
md public
move dist\main.exe public\arknights_mower.exe
- name: Package into zip
uses: vimtor/action-zip@v1
with:
files: public/
recursive: false
dest: arknights-mower_cp39_win_amd64_${{ steps.get_version.outputs.VERSION }}.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
body_path: doc/CHANGELOG.md
files: arknights-mower_cp39_win_amd64_${{ steps.get_version.outputs.VERSION }}.zip
5 changes: 3 additions & 2 deletions .github/workflows/pyinstaller-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Windows Binary Package
on:
push:
tags:
- 'v*'
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build-win-amd64:
Expand Down Expand Up @@ -42,5 +42,6 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: doc/CHANGELOG-${{ steps.get_version.outputs.VERSION }}.txt
draft: true
body_path: doc/CHANGELOG.md
files: arknights-mower_cp39_win_amd64_${{ steps.get_version.outputs.VERSION }}.zip
3 changes: 2 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ name: Upload PyPI
on:
push:
tags:
- 'v*'
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+'

jobs:
deploy:
Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# WSL
!main.spec
*.yaml
!arknights_mower/templates/*.yaml

# WSL
log/*
data/*
screenshot/*
screenshot_right/*
test/*
test_*
!main.spec
config.yaml
release_*.sh
test.py

# Windows

venv64
release_test.bat
public/*
publish/*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
graft arknights_mower/resources
graft arknights_mower/models
graft arknights_mower/fonts
graft arknights_mower/template
graft arknights_mower/templates
Loading

0 comments on commit f875e39

Please sign in to comment.