Skip to content

네이버 지하철 API가 Referer값을 요구함 #556

네이버 지하철 API가 Referer값을 요구함

네이버 지하철 API가 Referer값을 요구함 #556

Workflow file for this run

name: CI
on:
- push
- pull_request
jobs:
check-coding-convention:
name: Check Coding Convention
runs-on: ubuntu-latest
steps:
# Set-up
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
# Install Dependencies
- name: Install Checkers
run: pip install black ruff
# Lint
- name: Check coding convention
run: ruff check yui tests
- name: Check missing autofix
run: black --check .
test-program:
name: Test Program
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: kirito
POSTGRES_PASSWORD: eugeo
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis/redis-stack:latest
ports:
- 6379:6379
steps:
# Set-up
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup Poetry
run: |
pipx install --python $(which python) poetry
pipx inject poetry poetry-plugin-export
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
python -m venv .venv
.venv/bin/pip install --upgrade pip setuptools wheel
poetry install
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
# Type Check
- name: Check static types
run: mypy yui
# Test
- name: Run test cases
run: pytest -W always::DeprecationWarning -v --cov=yui --cov-report=xml --junitxml=junit.xml tests
env:
SQLALCHEMY_WARN_20: 1
YUI_TEST_DATABASE_URL: postgresql+psycopg://kirito:eugeo@localhost/test
GOOGLE_API_KEY: ${{ secrets.TEST_GOOGLE_API_KEY }}
NAVER_CLIENT_ID: ${{ secrets.TEST_NAVER_CLIENT_ID }}
NAVER_CLIENT_SECRET: ${{ secrets.TEST_NAVER_CLIENT_SECRET }}
# After jobs
- name: Export requirements.txt for docker build
run: |
poetry export --without dev -o requirements.txt --without-hashes
- name: Archive requirements.txt file
uses: actions/upload-artifact@v4
with:
name: python-deps
path: requirements.txt
- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [check-coding-convention, test-program]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: item4
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Fetch stored requirements.txt
uses: actions/download-artifact@v4
with:
name: python-deps
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: item4/yui:latest
cache-from: type=registry,ref=item4/yui:latest
cache-to: type=inline