Skip to content

Commit

Permalink
ci: add test (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Jul 1, 2023
1 parent 4cb0e19 commit b2096cd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 54 deletions.
74 changes: 26 additions & 48 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,33 @@ on:
- "master"

jobs:
# lint:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v3
#
# - name: Setup node
# uses: actions/setup-node@v3
# with:
# node-version: '18'
# cache: yarn
#
# - run: yarn
#
# - run: npx prettier --check ./
# - run: npx tsc --noEmit --pretty
# - run: yarn lint
test:
runs-on: ubuntu-latest

steps:
- run: git clone https://github.com/bangumi/dev-env $HOME/dev-env
- run: cd ~/dev-env && docker-compose up -d

- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: trim21/setup-poetry@dist/v1
- uses: trim21/install-poetry-project@dist/v1

- run: bash $HOME/dev-env/wait_mysql_ready.sh

- run: pytest --cov
timeout-minutes: 10
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_PORT: '3306'
MYSQL_USER: 'user'
MYSQL_PASS: 'password'
MYSQL_DB: 'bangumi'

# test:
# runs-on: ubuntu-latest
#
# steps:
# - run: git clone https://github.com/bangumi/dev-env $HOME/dev-env
# - run: cd ~/dev-env && docker-compose up -d
#
# - uses: actions/checkout@v3
#
# - name: Setup node
# uses: actions/setup-node@v3
# with:
# node-version: '18'
# cache: yarn
#
# - run: yarn
#
# - run: bash $HOME/dev-env/wait_mysql_ready.sh
#
# - run: yarn test --coverage
# timeout-minutes: 10
# env:
# HCAPTCHA_SECRET_KEY: '0x0000000000000000000000000000000000000000'
# MYSQL_HOST: '127.0.0.1'
# MYSQL_PORT: '3306'
# MYSQL_USER: 'user'
# MYSQL_PASS: 'password'
# MYSQL_DB: 'bangumi'
#
# - name: Upload Coverage to Codecov
# uses: codecov/codecov-action@v3
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3

build:
runs-on: ubuntu-latest
Expand Down
28 changes: 23 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sqlacodegen = "2.3.0"
# tests
coverage = { version = "==7.2.7", extras = ["toml"] }
pytest = "==7.4.0"
pytest-cov = "^4.1.0"
pytest-dotenv = "0.5.2"
pytest-github-actions-annotate-failures = "==0.2.0"
pytest-env = "==0.8.2"
Expand All @@ -51,7 +52,7 @@ exclude_lines = [
]

[tool.pytest.ini_options]
addopts = '-rav -W error::sqlalchemy.exc.RemovedIn20Warning'
addopts = '-rav'
env = ['D:TESTING=true', 'SQLALCHEMY_WARN_20=true']

[tool.mypy]
Expand Down

0 comments on commit b2096cd

Please sign in to comment.