model-training #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO, actions I eventually want to include: | |
# lint | |
# pytest / coverage | |
# great expectations | |
# mlflow | |
# trello | |
name: model-training | |
on: | |
schedule: | |
- cron: '0 9 * * 1' # Runs every Monday at 9:00 AM UTC | |
workflow_dispatch: | |
jobs: | |
retrain-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- uses: iterative/setup-cml@v1 | |
- name: Set up Python environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install --upgrade pip | |
pip install -r Streamlit/requirements.txt | |
- name: Train model | |
run: | | |
source venv/bin/activate | |
python Streamlit/train.py | |
- name: Create report.md | |
run: | | |
cat "Streamlit/Training Report/results.txt" > "Streamlit/Training Report/README.md" | |
echo "<p align='center'> <img src='residuals.png' alt='Residuals'> </p>" >> "Streamlit/Training Report/README.md" | |
- name: Commit results and update README | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git fetch origin main | |
git checkout main | |
git pull origin main | |
git add "Streamlit/Training Report/results.txt" | |
git add "Streamlit/Training Report/README.md" | |
git add "Streamlit/Training Report/residuals.png" | |
git add "Streamlit/light_weight_expected_strokes.pkl" | |
git commit -m "Add model, results, and report" | |
git push origin main |