diff --git a/.github/workflows/train-spread-predictor.yaml b/.github/workflows/train-spread-predictor.yaml new file mode 100644 index 0000000..d4a1783 --- /dev/null +++ b/.github/workflows/train-spread-predictor.yaml @@ -0,0 +1,58 @@ +name: NFL Analytics Pipeline + +on: + # schedule: + # - cron: '0 0 * * 2' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + # TODO: install in virtual env? https://python-poetry.org/docs/#ci-recommendations + # TODO: pin version? https://python-poetry.org/docs/#ci-recommendations + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + source $HOME/.poetry/env + poetry --version + + - name: Install dependencies with Poetry + run: poetry install + + - name: Run Python script + run: poetry run python main.py --download --train + + # TODO: tag name? release name? + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + with: + files: ./nfl_analytics/assets/* + env: + # TODO: what do i need to do for this? probably generate something on gh? + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload model, scaler, and running average dataframe + id: upload_assets + uses: actions/upload-artifact@v4 + with: + name: assets + path: ./nfl_analytics/assets/* + + - name: Attach assets to release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ needs.upload_assets.outputs.artifact_paths }} + asset_name: assets + asset_content_type: application/zip diff --git a/README.md b/README.md index 05d59fb..440d835 100644 --- a/README.md +++ b/README.md @@ -100,9 +100,13 @@ score differential is wrong? look at first game. the number for the 2 teams dont - [x] predict spread - [ ] github workflow - [ ] periodically train the model (and release model, scaler, running_avg_dfall w/ same timestamp) - - [ ] add save functionality to --train flag that saves the running_avg_df to assets - - [ ] update predict fn to only predict from this saved df. should ensure its always using latest data that model was trained with (instead of using new data model wasnt trained with when building from csv). + - [x] add save functionality to --train flag that saves the running_avg_df to assets + - [x] update predict fn to only predict from this saved df. should ensure its always using latest data that model was trained with (instead of using new data model wasnt trained with when building from csv). - [ ] periodically get upcoming games and make predictions. publish on github pages. get booky spread too? +- [ ] Github actions cleanup + - [ ] output model mean absolute error to md file and use as body of release (with any other info). have some release template. + - [ ] maybe release should use timestamp? + - [ ] (maybe) if there are any hardcoded paths (like asset dir?), think about how to not hardcode them. - Quality of Life Improvements - [ ] add cli doc generator. look into `argparse.HelpFormatter` to generate a markdown file. - [ ] add types