Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
grainyu committed Sep 28, 2023
0 parents commit ec77913
Show file tree
Hide file tree
Showing 378 changed files with 92,501 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
include =
common*
sql*
sql_api*
omit =
src*
downloads*
sql/migrations/*
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv
env
.env
local_settings.py
18 changes: 18 additions & 0 deletions .env.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://django-environ.readthedocs.io/en/latest/quickstart.html#usage
# https://docs.djangoproject.com/zh-hans/4.1/ref/settings/
DEBUG=false
DATABASE_URL=mysql://root:@127.0.0.1:3306/archery
CACHE_URL=redis://127.0.0.1:6379/0

# https://django-auth-ldap.readthedocs.io/en/latest/
ENABLE_LDAP=false
AUTH_LDAP_ALWAYS_UPDATE_USER=true
AUTH_LDAP_USER_ATTR_MAP=username=cn,display=displayname,email=email

# https://docs.djangoproject.com/en/4.0/ref/settings/#csrf-trusted-origins
CSRF_TRUSTED_ORIGINS=http://127.0.0.1:9123

# https://django-q.readthedocs.io/en/latest/configure.html#
Q_CLUISTER_WORKERS=4
Q_CLUISTER_TIMEOUT=60
Q_CLUISTER_SYNC=false
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js linguist-language=python
*.css linguist-language=python
*.html linguist-language=python
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 🐛 报告BUG
description: 报告BUG请务必使用这个模板,不规范的提交可能会被直接关闭
title: "请对问题进行简要的描述"
body:
- type: markdown
attributes:
value: |
感谢你花费时间来报告这个问题,在提交前请先查阅 [WIKI](https://github.com/hhyo/archery/wiki) | [FAQ](https://github.com/hhyo/archery/wiki/FAQ) 等文档,确保这是一个需要修复的问题🐛。如果是对于使用方法的咨询🤔🙏,或者你有好的想法和建议💡,请通过[Discussions](https://github.com/hhyo/Archery/discussions)来发布,再次感谢你对Archery的贡献 🎉🎉🎉
- type: textarea
id: what-happened
attributes:
label: 重现步骤
description: 现在告诉我们你遇到了什么问题,并描述问题出现场景和重现步骤
placeholder: |
1. 把冰箱门打开
2. 把大象放进去
3. 把冰箱门关上
validations:
required: true
- type: textarea
id: current-behavior
attributes:
label: 预期外的结果
description: |
告诉我们你遇到了什么错误,如果可以请提供相关截图信息
Tip: 你可以将文件拖拽过来以添加图片,但请确保已经处理了其中包含的敏感信息
validations:
required: true
- type: textarea
id: logs
attributes:
label: 日志文本
description: |
你可以将相关日志信息粘贴到此处,将会自动格式化处理,关于日志的查看方式
1. logs/archery.log
2. logs/qcluster.log
3. docker logs archery -f --tail=10
render: shell
validations:
required: false
- type: input
id: version
attributes:
label: 版本
description: 请告诉我们你正在使用的Archery版本
placeholder: 1.9.1
validations:
required: true
- type: dropdown
id: deploy
attributes:
label: 部署方式
description: 请告诉我们你的应用部署方式
options:
- Docker
- K8S
- 手工部署
validations:
required: true
- type: textarea
id: other-msg
attributes:
label: 是否还有其他可以辅助定位问题的信息?比如数据库版本等
description: |
部分信息可以在Archery的debug api中获取:[参考debug地址](https://demo.archerydms.com/api/debug?full=true)
- **MySQL**: 5.7.26
- **Browsers**: Chrome
- **goInception**: v1.2.5-49
validations:
required: false
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discussions
url: https://github.com/hhyo/Archery/discussions
about: 非Bug类的交流请在Discussions上发布
9 changes: 9 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Configuration for request-info - https://github.com/behaviorbot/request-info

# *Required* Comment to reply with
requestInfoReplyComment: >
你好!感谢你反馈的问题/bug,但是你的描述好像是空的,我们需要你完整的信息,这样才能帮你解决问题
如果不知道怎么写,在新建issue的时候有若干个模板可供选择,祝好!
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
requestInfoLabelToAdd: 请提供更多信息
28 changes: 28 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name-template: 'Release v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
categories:
- title: '变更说明'
labels:
- 'feature'
- 'enhancement'
- title: '修复说明'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '易用性改进'
labels:
- 'ease of use'
exclude-labels:
- 'skip-changelog'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## Release date: xxx年xx月xx日
代码变更: https://github.com/hhyo/Archery/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION
贡献者: $CONTRIBUTORS
$CHANGES
## 升级步骤
- https://github.com/hhyo/archery/wiki/upgrade
21 changes: 21 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 15
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 3
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug
- enhancement
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
你已经很久没有回复这个issue了,如果没有进一步的信息的话, 会作为不活跃issue关闭, 感谢你对本项目的贡献。
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
10 changes: 10 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '27 10 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
95 changes: 95 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Django CI

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

jobs:
django_ci:
name: Build and Test a Django Project
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

# https://github.com/actions/example-services/tree/master/.github/workflows
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: >-
--name=mysql
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: SET MySQL Cnf
run: |
cat << EOF > my.cnf
[mysqld]
server-id=100
log_bin=ON
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
lower_case_table_names=1
default-time_zone = '+8:00'
[client]
default-character-set=utf8mb4
EOF
docker cp my.cnf mysql:/etc/mysql/conf.d/
docker restart mysql
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install libsasl2-dev libkrb5-dev libldap2-dev libssl-dev unixodbc unixodbc-dev
python -m pip install --upgrade pip
pip install codecov coverage flake8 -r requirements.txt
- name: Init Table
run: |
mysql -h127.0.0.1 -uroot -e "CREATE DATABASE archery CHARSET UTF8MB4;"
mysql -h127.0.0.1 -uroot -e "DROP DATABASE IF EXISTS test_archery;CREATE DATABASE test_archery CHARSET UTF8MB4;"
mysql -h127.0.0.1 -uroot test_archery<src/init_sql/mysql_slow_query_review.sql
- name: Run Tests
run: |
python manage.py makemigrations
python manage.py makemigrations sql
coverage run --source='.' manage.py test -v 3 --keepdb
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
Loading

0 comments on commit ec77913

Please sign in to comment.