๐ Azure Functions + Timer trigger + GitHub Actions + Python3.10 + Pipenv + Util class + Flake8 + Unittest + Csv
ใใใชใตใณใใซใไฝใใใใใชใใ!
- Function App ใไฝใใใฃใคใฃใฆใใฟใๆๅใซๆใใฎใฏ "ใฉใใชใใฃใฌใฏใใชๆงๆใฎใชใใธใใชใซใชใใใ ใใ?" ใ ใใชใใใใ ใโ
- ใใใใปใผใใฃใฆ่ฆใชใใ Azure Function App ใ่ฆใใจใใฒใจใคใฎใชใฝใผในใฎไธญใซ่คๆฐใฎ functions ใใใใฎใใใใใญใ
<project_root>/
| - .venv/
| - .vscode/
| - my_first_function/
| | - __init__.py
| | - function.json
| | - example.py
| - my_second_function/
| | - __init__.py
| | - function.json
| - shared_code/
| | - __init__.py
| | - my_first_helper_function.py
| | - my_second_helper_function.py
| - tests/
| | - test_my_second_function.py
| - .funcignore
| - host.json
| - local.settings.json
| - requirements.txt
| - Dockerfile
- ใใฎใใฃใฌใฏใใชๆงๆใฏ Azure Functions ๆกๅผตๆฉ่ฝใงไฝใใ (VSC)
- Python ใใญใฐใฉใใณใฐใขใใซ v2 ใฏใใใฎใชใใธใใชใไฝใฃใฆใใๆฎต้ใงใฏใใฌใใฅใผใ
- venv ็ฐๅขใใใใฉใ ใใฉใใใฃใใใใฎใพใพ pipenv ใซๆฟใใใใจใใงใใใ
- CI/CD ใฏ Azure Function App ๅดใซใชใฝใผในใไฝใใจใใคใใงใซ GitHub Actions ใ่จญๅฎใงใใใใใใใใงใใฃใกใใใใ Secrets ใ็ป้ฒใใฆใใใฆๆฅฝใ ใใ
- ๆณจๆ: ใใใๆๅนใซใใใซใฏใชใฝใผในใฎ public url ใๆๅนใซใใๅฟ ่ฆใใใใไธๅบฆ "ใปใญใฅใชใใฃใฎใใใ" ใจใใใฃใฆ็กๅนใซใใใใใใญใคใใใจใ 403 ใๅบใพใใฃใใ
- Function App ใฏ App Service Plan ใฎไธใซใใใฃใฝใใฆใ slot ใไฝฟใใใจใใงใใใ
- ใใฎใชใใธใใชใงใฏ flake8 ใ unittest ใๅฐๅ ฅใใใใ yml ใ่ฆใใ้ฐๅฒๆฐใใใใใใ
- ใญใผใซใซ็ฐๅขใงๅฎ่กใใใจใใฏใใใชๆใโ
- F5 ๆผใใฆ Azure Tools ๆกๅผตๆฉ่ฝใใคใณในใใผใซ
- Azurite ๆกๅผตๆฉ่ฝใใคใณในใใผใซ
- Azurite: Start ใใ
- Terminal ใง func start ใใ
- ใญใผใซใซ็ฐๅขๅฎ่กใฎๅ่ใฏใใโ