diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml new file mode 100644 index 0000000..f138572 --- /dev/null +++ b/.github/workflows/cml.yaml @@ -0,0 +1,27 @@ +name: model-pipeline +on: [push] +jobs: + run: + runs-on: ubuntu-latest + # optionally use a convenient Ubuntu LTS + DVC + CML image + # container: docker://ghcr.io/iterative/cml:0-dvc2-base1 + steps: + - uses: actions/checkout@v2 + # may need to setup NodeJS & Python3 on e.g. self-hosted + # - uses: actions/setup-node@v2 + # with: + # node-version: '16' + # - uses: actions/setup-python@v2 + # with: + # python-version: '3.x' + - uses: iterative/setup-cml@v1 + - name: Train model + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Your ML workflow goes here + pip install -r requirements.txt + python model.py + echo "## Model metrics" > report.md + cat metrics.txt >> report.md + cml-send-comment report.md diff --git a/model.py b/model.py index 0176995..e1fa9d4 100644 --- a/model.py +++ b/model.py @@ -16,3 +16,5 @@ print(results.summary()) print('Parameters: ', results.params) print('R2: ', results.rsquared) +with open ("metrics.txt", "w") as f: + f.write(f"{results.summary().as_html()}")