Machine Learning 的 CI/CD
Ravi Bhadauria
Machine Learning Engineer
main 分支



將檔案存為分支中的 hello_world.py
import datetime
def main():
print("Hello, World!")
# Get the current time and print it
current_time = datetime.datetime.now()
print("Current time:", current_time)
if __name__ == "__main__":
main()
on:
pull_request:
branches: [ "main" ]
steps:
- name: My Action
uses: <org_or_user_name>/<reponame>@<version_number>
with:
action-argument: value
動作(Action)儲存庫 https://github.com/<org_or_user_name>/<reponame>
可用 with 提供參數
GitHub Marketplace 動作:https://github.com/actions
steps:
- name: Checkout
uses: actions/checkout@v3
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
main 建立 Pull Request 時觸發build 工作含三個步驟Checkout 取出儲存庫Setup Python 設定 Python 環境Run Python script 執行該 Python 檔案name: PR
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Run Python script
run: |
echo hello_world.py
python hello_world.py


Machine Learning 的 CI/CD