Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
/ travis2gha Public archive

Ad hoc script for converting my Python projects from Travis to GitHub Actions

License

Notifications You must be signed in to change notification settings

jwodder/travis2gha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. MIT License

GitHub | Issues

travis2gha is a Python program that I wrote in order to automate the switch from Travis to GitHub Actions for my Python projects. When run in a clone of a GitHub repository containing a setuptools-based Python project, it performs the following tasks:

  • Create a GitHub workflow .github/workflows/test.yml for running tox -e py against an array of Python versions (determined automatically from the Python project's classifiers) with coverage stats uploaded to Codecov, along with running zero or more custom tox testenvs (without coverage) against specific Python versions as specified on the command line. The workflow is configured to run on pushes, on pull requests, and once a day in the middle of the night.
  • Replace the Travis status badge in README.rst with a GitHub Actions status badge
  • Delete .travis.yml

Now that I'm done with it, this repository merely serves as a example & template for others. It is not (and does not try to be) appropriate for general use. If you need the project to do something even slightly differently, you are encouraged to fork the code and make it your own.

Installation

travis2gha requires Python 3.8 or higher. Just use pip for Python 3 (You have pip, right?) to install travis2gha and its dependencies:

python3 -m pip install git+https://github.com/jwodder/travis2gha.git

Usage

run

travis2gha run [<options>]

Perform all of the steps listed above.

Options

--no-pytest-cov
 Indicates that passing --cov-report=xml to the tox run is not an option and that the XML coverage must be generated externally
--testenv NAME_PYVER
 [Specify NAME and PYVER as separate arguments] Configure the generated workflow to also run tox -e NAME against Python version PYVER. This option can be specified multiple times.

workflow

travis2gha workflow [<options>]

Output a GitHub Actions workflow for the current repository. This is the same workflow that would be generated by the run command.

Options

--no-pytest-cov
 Indicates that passing --cov-report=xml to the tox run is not an option and that the XML coverage must be generated externally
-o, --outfile FILE
 Save the workflow to the given file. By default, the workflow is printed to standard output.
--testenv NAME_PYVER
 [Specify NAME and PYVER as separate arguments] Configure the generated workflow to also run tox -e NAME against Python version PYVER. This option can be specified multiple times.

secrets

travis2gha secrets [<options>]

Create specified workflow secrets in the GitHub repository. This was used in a previous version of this package until I realized that the workflow step it was enabling was redundant. However, the command remains for future reference.

This command relies on a secrets file for creating secrets in a repository. This file is an INI format file containing the following sections:

[auth]
Must contain a token option giving a GitHub OAuth token to use to set the repository's secrets over the GitHub API
[secrets]
Each option in this section specifies a secret to create with the given name & value.

Options

-S, --secrets FILE
 INI file containing [auth]token and [secrets] sections. Run travis2gha secrets --help to see the default location of this file for your system.

About

Ad hoc script for converting my Python projects from Travis to GitHub Actions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published