xcookie.builders.github_actions module

class xcookie.builders.github_actions.Actions[source]

Bases: object

Help build Github Action JSON objects

Example

>>> from xcookie.builders.github_actions import Actions
>>> import types
>>> for attr_name in dir(Actions):
>>>     if not attr_name.startswith('_'):
>>>         attr = getattr(Actions, attr_name)
>>>         if isinstance(attr, types.MethodType):
>>>             print(attr_name)
>>>             action = attr()

Example

>>> action = Actions.codecov_action(Yaml.coerce(
    '''
    name: Codecov Upload
    with:
      file: ./coverage.xml
      token: ${{ secrets.CODECOV_TOKEN }}
    '''))
>>> print(type(action))
>>> print(f'action = {ub.urepr(action, nl=1)}')
action_versions = {'checkout': 'actions/checkout@v3', 'setup-python': 'actions/setup-python@v5'}
classmethod _available_action_methods()[source]
classmethod _check_for_updates()[source]
classmethod action(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]

The generic action.

TODO: support commented YAML maps

classmethod checkout(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod setup_python(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod codecov_action(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]

References

https://github.com/codecov/codecov-action

classmethod combine_coverage(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod upload_artifact(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod download_artifact(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod msvc_dev_cmd(*args, osvar=None, bits=None, test_condition=None, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod setup_qemu(*args, sensible=False, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod setup_xcode(*args, sensible=False, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod setup_ipfs(*args, **kwargs) Mapping[str, str | int | float | bool | None | Sequence[JSON] | Mapping[str, JSON]][source]
classmethod cibuildwheel(*args, sensible=False, **kwargs)[source]
xcookie.builders.github_actions._render_workflow_text(name, on_lines, jobs, footer='')[source]
xcookie.builders.github_actions._collect_test_jobs(self)[source]
xcookie.builders.github_actions._collect_release_jobs(self)[source]
xcookie.builders.github_actions.build_github_actions(self)[source]
xcookie.builders.github_actions.build_github_actions_tests(self)[source]
xcookie.builders.github_actions.build_github_actions_release(self)[source]
xcookie.builders.github_actions.lint_job(self)[source]
xcookie.builders.github_actions.build_and_test_sdist_job(self)[source]
xcookie.builders.github_actions.build_binpy_wheels_job(self)[source]

Builds the action for binary python packages that creates the wheels.

Returns:

yaml structure

Return type:

Dict

cat ~/code/xcookie/xcookie/rc/test_binaries.yml.in | yq .jobs.build_and_test_wheels

Notes

Supported Action platforms:

https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json

xcookie.builders.github_actions.build_purewheel_job(self)[source]
xcookie.builders.github_actions.build_sdist_job(self)[source]
xcookie.builders.github_actions.build_binpy_wheels_release_job(self)[source]
xcookie.builders.github_actions.test_wheels_job(self, needs=None)[source]
xcookie.builders.github_actions.build_deploy(self, mode='live', needs=None)[source]

CommandLine

xdoctest -m /home/joncrall/code/xcookie/xcookie/builders/github_actions.py build_deploy
xdoctest -m xcookie.builders.github_actions build_deploy

Example

>>> from xcookie.builders.github_actions import *  # NOQA
>>> from xcookie.main import XCookieConfig
>>> from xcookie.main import TemplateApplier
>>> config = XCookieConfig(tags=['purepy'], remote_group='Org', repo_name='Repo')
>>> self = TemplateApplier(config)
>>> self._presetup()
>>> text = Yaml.dumps(build_deploy(self))
>>> print(text)
xcookie.builders.github_actions.build_github_release(self, needs=None)[source]

References

https://github.com/marketplace/actions/create-a-release-in-a-github-action https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/issues/20#issuecomment-572245945