Skip to content

Commit

Permalink
update workfows yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
521xueweihan committed Mar 7, 2021
1 parent fa7a749 commit 84be014
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 47 deletions.
71 changes: 28 additions & 43 deletions .github/workflows/hydra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,34 @@ on:
jobs:
build:
runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: [3.9.1]
# services:
# mysql:
# image: mysql:5.7
# env:
# MYSQL_ALLOW_EMPTY_PASSWORD: yes
# MYSQL_DATABASE: hellogithub
# ports:
# - 3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
python-version: [3.9.1]
steps:
- uses: mirromutth/[email protected]
with:
character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
mysql version: '8.0' # Optional, default value is "latest". The version of the MySQL
mysql database: 'hellogithub' # Optional, default value is "test". The specified database which will be create
mysql root password: 123456 # Required if "mysql user" is empty, default is empty. The root superuser password
- uses: actions/checkout@v2
- uses: finnp/create-file-action@master
env:
FILE_NAME: "fileName.txt"
FILE_DATA: ${{ secrets.LOCAL_ENV }}
- name: Read package.json
id: package
uses: juliangruber/read-file-action@v1
- name: Create env file
run: |
touch .local_env.yaml
echo "${{ secrets.LOCAL_ENV }}" > .local_env.yaml
cat .local_env.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
path: fileName.txt
- name: Echo local_env.yaml
run: echo ${{ steps.package.outputs.content }}

# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
#
# - run: 'echo "$LOCAL_ENV" > .local_env.yaml'
# shell: bash
# env:
# LOCAL_ENV: ${{ secrets.LOCAL_ENV }}
# - name: Install dependencies
# run: |
# pip install poetry==1.1.4 && poetry config virtualenvs.create false --local
# poetry install --no-root
# - name: update coverage
# env:
# CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
# run: |
# pytest --cov=hydra --cov-report=xml hydra/tests --cov-fail-under=95
# python-codacy-coverage -r coverage.xml
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry==1.1.4 && poetry config virtualenvs.create false --local
poetry install --no-root
- name: update coverage
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
pytest --cov=hydra --cov-report=xml hydra/tests --cov-fail-under=95
python-codacy-coverage -r coverage.xml
12 changes: 8 additions & 4 deletions hydra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Config(object):

@classmethod
def sentry_config(cls) -> dict:
config = cls.conf["sentry"]
config = cls.conf.get("sentry", {})
config["environment"] = cls.run_mode
return config

Expand All @@ -34,15 +34,19 @@ def database_url(cls) -> str:

@classmethod
def wechat(cls) -> tuple:
return "wechat", cls.conf["wechat"]["account"], cls.conf["wechat"]["token"]
return (
"wechat",
cls.conf.get("wechat", {}).get("account", ""),
cls.conf.get("wechat", {}).get("token", ""),
)

@classmethod
def toutiao(cls) -> dict:
return make_cookie(cls.conf["toutiao"]["cookie"])
return make_cookie(cls.conf.get("toutiao", {}).get("cookie", ""))

@classmethod
def zhihu(cls) -> dict:
return make_cookie(cls.conf["zhihu"]["cookie"])
return make_cookie(cls.conf.get("zhihu", {}).get("cookie", ""))


logger = init_log(Config.NAME)

0 comments on commit 84be014

Please sign in to comment.