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:
-
Checkout code
- Name: Checkout code
- Uses:
actions/checkout@v2
- Description: This step checks out the repository code onto the runner.
-
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
.
-
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 therequirements.txt
file.
-
Run tests
- Name: Run tests
- Run:
pytest tests
- Description: This step executes the test suite by running the
pytest
command with thetests
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyciactions-1.0.8a4.tar.gz
.
File metadata
- Download URL: pyciactions-1.0.8a4.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59cc19e4c34d241514be901ccce47b039f64a0eb1c2ce2d3311604bda0a6922 |
|
MD5 | 9c341aa59d57e6dbf43f6bc7bb66381c |
|
BLAKE2b-256 | c6235a311eef77749fcaf162173b0c526b3eb1bf7c924ef028ef64fb6007d3a6 |
File details
Details for the file pyciactions-1.0.8a4-py3-none-any.whl
.
File metadata
- Download URL: pyciactions-1.0.8a4-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfc00e832665b62915ea803c6bf4ca84641a4d9feb6b8f8e3ca99f2ed3492975 |
|
MD5 | b1f090bed053e4e2f1b55e887c4896d0 |
|
BLAKE2b-256 | a0e29cdafd7d89d0fc1ed1b766a53ef0afeb2155b389487bac4ee08d8394b0f2 |