Skip to main content

Declarative builder for Github Action Scripts

Project description

Python CI Workflow Documentation

This documentation provides an overview of the Python CI workflow implemented using GitHub Actions.

Workflow Overview

The Python CI workflow is triggered by two events: pushes to the main branch and pull requests targeting the main branch. It consists of a single job named build, which runs on an ubuntu-latest environment.

Steps

The following steps are executed as part of the workflow:

  1. Checkout code

    • Name: Checkout code
    • Uses: actions/checkout@v2
    • Description: This step checks out the repository code onto the runner.
  2. Setup Python

    • Name: Setup Python
    • Uses: actions/setup-python@v2
    • Description: This step sets up the Python environment for subsequent steps. The Python version used is 3.8.
  3. Install dependencies

    • Name: Install dependencies
    • Run: pip install -r requirements.txt
    • Description: This step installs the project dependencies by running pip install with the requirements specified in the requirements.txt file.
  4. Run tests

    • Name: Run tests
    • Run: pytest tests
    • Description: This step executes the test suite by running the pytest command with the tests directory.

Workflow Definition

The workflow is defined using the pyactions Python package. The workflow definition code is as follows:

from datetime import datetime
from pyciactions.github import Step, Job, On, Workflow, BranchEvent
from pyciactions import generate
import yaml

# Define 'on' conditions
on_push_main = On(push=BranchEvent(branches=["main"]))
on_pull_request_main = On(pull_request=BranchEvent(branches=["main"]))

# Define steps
checkout_code = Step(name="Checkout code",
                     uses="actions/checkout@v2")

setup_python = Step(name="Setup Python",
                    uses="actions/setup-python@v2",
                    with_={"python-version": "3.8"})

install_deps = Step(name="Install dependencies",
                    run="pip install -r requirements.txt")

run_tests = Step(name="Run tests",
                 run="pytest tests")

# Define job
job = Job("build",
          runs_on="ubuntu-latest",
          steps=[checkout_code, setup_python, install_deps, run_tests])

# Define workflow
workflow = Workflow(name="Python CI",
                    on=[on_push_main, on_pull_request_main],
                    jobs=[job])

# Generate workflow file
generate(workflow, ".github/workflows/python_ci.yml")

The generated workflow file, python_ci.yml, can be found in the .github/workflows directory of the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyciactions-1.0.8a6.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

pyciactions-1.0.8a6-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file pyciactions-1.0.8a6.tar.gz.

File metadata

  • Download URL: pyciactions-1.0.8a6.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pyciactions-1.0.8a6.tar.gz
Algorithm Hash digest
SHA256 26f2695e4a3e1481ad7f81351d9575539cb8a50277f3d5843a7e42892c92ef8b
MD5 9c5708ab8e4d797e522027ff85550b4b
BLAKE2b-256 c61b8d551387db8891385c7fe61b9e11c6a498045363b8b4c608455f7f6560f8

See more details on using hashes here.

File details

Details for the file pyciactions-1.0.8a6-py3-none-any.whl.

File metadata

File hashes

Hashes for pyciactions-1.0.8a6-py3-none-any.whl
Algorithm Hash digest
SHA256 e4a22507632b1952b5de327a8ca46451b37b9181ce76008818c5fa735bcdda2f
MD5 d2417b7b8d7cb7f182f7515dbb646a29
BLAKE2b-256 9417a7fd1c896eead824faf8544d17ff5afd05bc6fb860a22d748e5a170908fe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page