Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: CI 통합 #42

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]


jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black isort
- name: Checking style
run: |
black ./koreanbots --check
isort ./koreanbots --check --profile=black

type:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo npm install -g pyright
python -m pip install -r requirements.txt
python -m pip install mypy
- name: Install integrations
run: |
python -m pip install git+https://github.com/rapptz/discord.py
python -m pip install dico nextcord disnake
- name: Checking type annotations
run: |
mypy ./koreanbots --strict
pyright ./koreanbots --outputjson

build:
runs-on: ubuntu-latest
needs: [ style, type ]
strategy:
matrix:
python-version: [ 3.8, 3.9 ]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-asyncio
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest --cov=koreanbots --cov-report=xml
- name: Codecov
uses: codecov/codecov-action@v1

deploy:
runs-on: ubuntu-latest
needs: [ style, type, build ]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
Comment on lines +76 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 프로세스는 빌드가 생성 될시에만 실행이 되나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우선 build에 의존시켜뒀으니, 그럴거라고 생각합니다. 다만 테스트에서 오류가 나 이후의 동작은 확인하지 못했습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 오류 해결 후 확인했습니다. build까지 동작 이후에 deploy가 동작합니다.

Copy link
Contributor

@SaidBySolo SaidBySolo Sep 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배포는 릴리즈 이벤트가 발생될때만 작동하게 하면 될것같아요 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아아 그러네요!

35 changes: 0 additions & 35 deletions .github/workflows/python-package.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/python-publish.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/python-style.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/python-type.yml

This file was deleted.

3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@

@fixture
async def client():
"""
client params in test.
"""
yield Koreanbots(api_key=getenv("API_KEY"))