Skip to main content

Time and group logs for GitHub actions

Project description

gha-timer

PyPI Release CI Python Versions MyPy Checked Poetry Ruff

Time and group logs for GitHub actions

Fulcrum Genomics

Visit us at Fulcrum Genomics to learn more about how we can power your Bioinformatics with fetch-through-merge-base and beyond.

Motivation

This GitHub action and associated command-line tool enable log grouping and printing of the elapsed time of that log group, with colored icons next to the elapsed based on the provided outcome (success, failure, cancelled, or skipped).

Fulcrum Genomics

Usage

jobs:
  job:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: fulcrumgenomics/gha-timer@v1
      - id: example
        shell: bash
        run: |
          gha-timer start --name build
          ... do something
          gha-timer elapsed --name build

Inputs

- uses: fulcrumgenomics/gha-timer@v1
  with:
    # The color of the success outcome
    # Default: green
    success-color: ''

    # The icon to use for the success outcome
    # Default: ✓
    success-icon: ''

    # The color of the failure outcome
    # Default: red
    failure-color: ''

    # The icon to use for the failure outcome
    # Default: ✕
    failure-icon: ''

    # The color of the cancelled outcome
    # Default: yellow
    cancelled-color: ''

    # The icon to use for the cancelled outcome
    # Default: ✕
    cancelled-icon: ''

    # The color of the skipped outcome
    # Default: gray
    skipped-color: ''

    # The icon to use for the skipped outcome
    # Default: ✕
    skipped-icon: ''

Outputs

There are currently no outputs

Command Line Tool

Quickstart

Install command line tool:

pip install gha-timer

Start a timer:

$ gha-timer start

Get the elapsed time:

$ gha-timer elapsed --outcome success
                                                                      ✓ 10.8s
$ gha-timer elapsed --outcome failure
                                                                      ✕ 20.2s
$ gha-timer elapsed --outcome cancelled
                                                                      ✕ 33.6s
$ gha-timer elapsed --outcome skipped  
                                                                      ✕ 37.3s

Stop the timer:

$ gha-timer stop

Use the --name option to add group log lines:

$ gha-timer start --name "Build the project"
::group::Build the project
$ gha-timer elapsed --outcome success --name "Build the project"
::endgroup::Build the project
                                                                      ✓ 19.2s

Specify a custom configuration file with --config (or just create a ~/.timerrc) to control the color and icon for each outcome (steps.<step_id>.outcome: success, failure, cancelled, or skipped). Below is the default configuration:

success:
  color: green
  icon: "✓"
failure:
  color: red
  icon: "✕"
cancelled:
  color: yellow
  icon: "✕"
skipped:
  color: gray
  icon: "✕"

Supported colors are: red, green, yellow, blue, cyan, bright_red, bright_green, white, gray, and bg_grey.

Recommended Installation

Install the Python package and dependency management tool poetry using official documentation. You must have Python 3.11 or greater available on your system path, which could be managed by mamba, pyenv, or another package manager. Finally, install the dependencies of the project with:

poetry install

To check successful installation, run:

poetry run gha_timer hello --name Fulcrum

Installing into a Mamba Environment

Install the Python package and dependency management tool poetry and the environment manager mamba using official documentation. Create and activate a virtual environment with Python 3.11 or greater:

mamba create -n gha_timer python=3.11
mamba activate gha_timer

Then, because Poetry will auto-detect an activated environment, install the project with:

poetry install

To check successful installation, run:

$ gha-timer start
$ gha-timer elapsed --outcome success
$ gha-timer stop

Development and Testing

See the contributing guide for more information.

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

gha_timer-1.0.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gha_timer-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file gha_timer-1.0.0.tar.gz.

File metadata

  • Download URL: gha_timer-1.0.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gha_timer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 163196a72f29773c8ecb3789357146d885db5b5fcb9a56bf889d8a5035eed8a7
MD5 68c460b28f972019e5be866ac3770a15
BLAKE2b-256 79b0a8353bd081871597e637fb42ec1237078c43f570ef625acc43388bf5e2ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for gha_timer-1.0.0.tar.gz:

Publisher: publish_gha_timer.yml on fulcrumgenomics/gha-timer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gha_timer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gha_timer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gha_timer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb9172490672614c2b02115ece5b7ac17b8b1d01a1b277fba232766497e32bf3
MD5 4d870facb9f853bfcfd0b6ecd7939cbc
BLAKE2b-256 794adb952d9c6c8d10c1f0b28fff8af681d07c9ab1aacac152ff924477ece640

See more details on using hashes here.

Provenance

The following attestation bundles were made for gha_timer-1.0.0-py3-none-any.whl:

Publisher: publish_gha_timer.yml on fulcrumgenomics/gha-timer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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