Quacken8 / MagneticDisconnectSimulator

Python simulator of disconnection of solar magnetic field from its roots inpsired by Schüssler and Rempel (2018)
1 stars 0 forks source link

Allow CI pipeline for your unit tests #11

Open mejroslav opened 1 year ago

mejroslav commented 1 year ago

Inside .github/workflows create YAML file python_ci.yaml:


---
name: Python CI

on:
  push:
    branches:
      - main  # Replace with the name of your main branch

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.x  # Replace with the desired Python version

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt  # Replace with your dependencies

    - name: Run unit tests
      run: python -m unittest UnitTest.py

Commit it to the main branch. After that, every time you push a new commit, GitHub Actions will setup your python project on Ubuntu and run all the unit tests automatically. You can even allow sending emails if the pipeline fails.

You can additionally setup flake8 check or something if you're interested.

mejroslav commented 1 year ago

Checkout https://github.com/mejroslav/github-actions-test