Skip to content

Latest commit

 

History

History
157 lines (107 loc) · 3.64 KB

DEPLOYMENT.md

File metadata and controls

157 lines (107 loc) · 3.64 KB

YFPY Deployment

  1. (Optional) Clear virtual machine of old requirements:

    pip uninstall -y -r <(pip freeze)
  2. (Optional) Check requirements.txt and requirement-dev.txt for latest dependency versions.

  3. (Optional) Update virtual machine with the latest dependencies:

    pip install -r requirements.txt -r requirements-dev.txt
  4. Lint code with flake8:

    flake8 . --count --show-source --statistics
  5. Check code security with bandit:

    bandit -r yfpy/
  6. Run all pytest tests (see following commands for running subsets of tests):

    python -m pytest
  7. Run all pytest tests verbosely:

    python -m pytest -v -s
  8. Run pytest integration tests:

    python -m pytest -v -s -m integration
  9. (Optional) Run all tests from pytest file:

    python -m pytest -v -s -m integration test/integration/test_api_game_data.py
  10. (Optional) Run specific test from pytest file:

    python -m pytest -v -s -m integration test/integration/test_api_game_data.py -k test_get_game_key_by_season
  11. (Optional) Test Python support using act for GitHub Actions:

    act_amd -j build

    Note: If act is unable to locate Docker, make sure that the required /var/run/docker.sock symlink exists. If it does not, you can fix it by running:

    sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock`
  12. (Optional) Build the PyPI package independent of deployment:

    make build
  13. (Optional) Test packages for PyPI deployment:

    make verify_build
  14. (Optional) Check MkDocs documentation by serving it at http://localhost:8000/ locally:

    make test_docs
  15. (Optional) Build the PyPI package and MkDocs documentation independent of deployment:

    make docs

    Note: Running make test_docs from the previous step recreates the documentation without building the PyPI package with setup.py.

  16. Create a git commit:

    git add .
    git commit -m 'commit message'
  17. Update the git tag with the new version:

    git tag -a [tag_name/version] -m [message]

    git tag -a v1.0.0 -m 'release message'
    git push origin --tags
  18. Install twine (if not already installed):

    pip install twine
  19. (Optional) Test deployment by building the PyPI packages, recreating the documentation, and deploying to Test PyPI:

    make test_deploy
  20. Deploy YFPY by building the PyPI packages, recreating the documentation, and deploying to PyPI:

    make deploy
  21. Build Docker container:

    docker compose -f compose.yaml -f compose.build.yaml build
  22. (If needed) Authenticate with GitHub Personal Access Token (PAT):

    jq -r .github_personal_access_token.value private-github.json | docker login ghcr.io -u uberfastman --password-stdin
  23. Deploy the newly-built Docker image with respective major, minor, and patch version numbers to the GitHub Container Registry:

    docker push ghcr.io/uberfastman/yfpy:X.X.X
  24. Create a second git commit with updated version number and documentation:

    git add .
    git commit -m 'update version number and docs'
  25. Update YFPY GitHub repository:

    git push