Introduce Continuous Integration (CI) to the starpy Python project
One of the first thing I do when start working on a project (either open source or in a corporation) is to make sure the is a Continuous Integration system set up. In this video you will see how I added GitHub Actions to the starpy project.
The points I made
- Make sure you have the python requirements listed in the requirements.txt file
- Make sure you can run pytest and it will find your tests. (test filenames start with test_*
- Having a README.md is also a nice thing with instruction how to set up an environment and how to run the tests.
This is the content of the .github/workflows/ci.yaml file from the project that configures GitHub Actions.
examples/starpy/ci.yaml
name: CI on: push: pull_request: jobs: build_python: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - name: Checkout uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: pip install -r requirements.txt - name: Check Python version run: python -V - name: Test with pytest run: pytest -vs
Published on 2022-09-13