github에서 제공하는 workflow를 자동화할 수 있도록 도와주는 도구
대표적인 예 : CI/CD
CI/CD란?
- CI: Continuous Integration(지속적 통합)
- 테스트, 빌드, Dockerizing, 저장소에 전달하는 것까지 프로덕션 환경으로 서비스를 배포할 수 있도록 준비하는 프로세스
- CD: Continuous Delivery(지속적 전달)
- 저장소로 전달된 프로덕션 서비스를 실제 사용자들에게 배포하는 프로세스
한마디로 배포 자동화라고 할 수 있겠다
1. Workflow
2. Event
3. Job
4. Step
5. Action
6. Runner
name: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 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 flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
name: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
_그 아래 Job은 대충 flask8을 통해 pytest를 실행하는내용으로, 실행하고 싶은 코드를 작성해야 함