{"id":21222081,"url":"https://github.com/mrthearman/ci","last_synced_at":"2026-05-20T15:16:36.443Z","repository":{"id":65266484,"uuid":"532451103","full_name":"MrThearMan/CI","owner":"MrThearMan","description":"CI pipelines","archived":false,"fork":false,"pushed_at":"2025-01-11T07:02:02.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T17:13:43.166Z","etag":null,"topics":["ci","github-actions","pipelines","python-poetry"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrThearMan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-04T05:52:14.000Z","updated_at":"2025-01-11T07:01:28.000Z","dependencies_parsed_at":"2023-02-18T18:00:47.505Z","dependency_job_id":"62f0d8cd-cf0f-4d85-9661-e1aabaaef3d6","html_url":"https://github.com/MrThearMan/CI","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2FCI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2FCI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2FCI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2FCI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrThearMan","download_url":"https://codeload.github.com/MrThearMan/CI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243668234,"owners_count":20328042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","github-actions","pipelines","python-poetry"],"created_at":"2024-11-20T22:39:34.482Z","updated_at":"2026-05-20T15:16:36.437Z","avatar_url":"https://github.com/MrThearMan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reusable CI pipelines for poetry projects\n\n\u003e This is meant for personal use for my own projects.\n\n## Requirements\n\nThere are 4 different pipeline templates, one for testing,\none for building docs, one for releasing the library to [PyPI],\nand one for approving pull requests by certain authors automatically.\n\nAll templates require the project to use [poetry].\nThe testing pipeline requires [tox] and [coverage], as well as \nCoverage results are sent to [coveralls].\nThe docs building pipeline requires [mkdocs].\n\n## How to use\n\nHere is the required configuration for your `pyproject.toml`:\n\n```toml\n# ...\n\n[tool.poetry.group.test.dependencies]\npytest = \"...\"  # use latest version\ncoverage = \"...\"  # use latest version\nnox = \"...\"  # use latest version\n\n# This is only needed for the docs CI\n[tool.poetry.group.docs.dependencies]\nmkdocs = \"...\"  # use latest version\n\n[tool.coverage.run]\nrelative_files = true\n\n[build-system]\nrequires = [\"poetry-core\u003e=2.0.0\"]\nbuild-backend = \"poetry.core.masonry.api\"\n```\n\n---\n\n### Testing pipeline\n\nThis pipeline uses a [job strategy matrix] to run tests in a number of\npython environments and operating systems in parallel. All dependencies\nare cached for each os and environment resulting from the strategy\nto ensure the CI runs fast when dependencies are not updated.\n\nTo set up the pipeline, add a `yml` file to `./.github/workflows/` \nwith the following job configuration.\n\n```yaml\nname: Tests\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - \"**.py\"\n      - \"pyproject.toml\"\n      - \"poetry.lock\"\n  pull_request:\n  workflow_dispatch:\n\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n```\n\nTest pipelines use [nox](https://nox.thea.codes/en/stable/) to run the tests.\nYou'll need to add a `noxfile.py` to the root of your project with the following\ncontent:\n\n```python\nfrom pathlib import Path\n\nimport nox\n\n\n@nox.session(python=[\"3.10\", \"3.11\", \"3.12\", \"3.13\"], reuse_venv=True)\ndef tests(session: nox.Session) -\u003e None:\n    env = {\"POETRY_VIRTUALENVS_PATH\": str(Path(session.virtualenv.bin).parent)}\n    session.run_install(\"poetry\", \"install\", \"--all-extras\", \"--all-groups\", external=True, env=env)\n    session.run(\"coverage\", \"run\", \"-m\", \"pytest\", external=\"error\")\n```\n\nThis job can take a number of inputs via the [with]-keyword.\n\n---\n\n#### `python-version`\n\nConfigure the python versions the test will be run with.\nThe tox [environments] used are configured with the\n`[gh-actions]` setting in `pyproject.toml`.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      python-version: '[\"3.11\", \"3.12\", \"3.13\", \"3.14\"]'\n```\n\n---\n\n#### `os`\n\nConfigure the operating systems the tests will be run with.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      os: '[\"ubuntu-latest\", \"macos-latest\", \"windows-latest\"]'\n```\n\n---\n\n#### `env`\n\nEnvironment variables to set in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      env: '{\"FOO\": \"bar\"}'\n```\n\n---\n\n#### `poetry-version`\n\nConfigure the poetry version used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      poetry-version: \"2.3.2\"\n```\n\n---\n\n#### `exclude`\n\nGitHub [job strategy matrix] exclusion pattern, in JSON form.\nUsing [yaml flow style], a list of dicts can be converted into\nmultiple exclusions if necessary.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      exclude: '[{\"os\": \"none\", \"python-version\": \"none\"}]'  # this ignores nothing\n```\n\n---\n\n#### `submodules`\n\nShould submodules be checked out with the repository?\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      submodules: false\n```\n\n---\n\n#### `fetch-depth`\n\nHow many commit to fetch from the branch history?\nIf set to 0, every commit is fetched.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      fetch-depth: 1\n```\n\n---\n\n#### `coveralls`\n\nShould coverage results be submitted to [coveralls]?\nRequires coveralls setup to already exist.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      coveralls: true\n```\n\n---\n\n#### `coveralls-os`\n\nWhich operating system should be covered using [coveralls]?\nShould be one of the operating systems configured with `os`.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      coveralls-os: \"ubuntu-latest\"\n```\n\n---\n\n### Docs building pipeline\n\nThis pipeline can be used to build and push the docs used for \n[mkdocs] from the `docs/` directory into [GitHub pages].\n\n\u003e Note that [mkdocs] also requires a separate configuration \n\u003e file where the pages are set up. Here's a minimal example configuration.\n\u003e \n\u003e ```yaml\n\u003e site_name: {{ Site name here }}\n\u003e \n\u003e nav:\n\u003e   - Home: index.md  # ./docs/index.md\n\u003e ```\n\nTo set up the pipeline, add a `yml` file to `./.github/workflows/` \nwith the following job configuration.\n\n```yaml\nname: Docs\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - \"docs/**\"\n      - \"mkdocs.yml\"\n  workflow_dispatch:\n\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/docs.yml@v0.5.2\n```\n\nThis job can take a number of inputs via the [with]-keyword.\n\n---\n\n#### `poetry-version`\n\nConfigure the poetry version used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/docs.yml@v0.5.2\n    with:\n      poetry-version: \"2.3.2\"\n```\n\n---\n\n#### `python-version`\n\nConfigure the python version used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/docs.yml@v0.5.2\n    with:\n      python-version: \"3.14\"\n```\n\n---\n\n#### `os`\n\nConfigure the operating system used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/docs.yml@v0.5.2\n    with:\n      os: \"ubuntu-latest\"\n```\n\n---\n\n#### `env`\n\nEnvironment variables to set in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/docs.yml@v0.5.2\n    with:\n      env: '{\"FOO\": \"bar\"}'\n```\n\n---\n\n#### `submodules`\n\nShould submodules be checked out with the repository?\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      submodules: false\n```\n\n---\n\n#### `fetch-depth`\n\nHow many commit to fetch from the branch history?\nIf set to 0, every commit is fetched.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      fetch-depth: 1\n```\n\n---\n\n### PyPI release pipeline\n\nThis pipeline can be used to build and release the library to [PyPI] with \npoetry using a [PyPI token] stored in the repository's [actions secrets].\n\n\u003e Note that the poetry [version] configuration needs to be updated and match\n\u003e the tag created for the release or this job will fail (can include v-prefix,\n\u003e e.g., `v0.0.1`).\n\nTo set up the pipeline, add a `yml` file to `./.github/workflows/`\nwith the following job configuration. The `pypi-token` input is required.\n\n```yaml\nname: Release\n\non:\n  release:\n    types:\n      - released\n\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/release.yml@v0.5.2\n    secrets:\n      pypi-token: ${{ secrets.PYPI_API_TOKEN }}\n```\n\n\u003e Replace `PYPI_API_TOKEN` with the secret name of your choice\n\nThis job can take a number of inputs via the [with]-keyword.\n\n---\n\n#### `poetry-version`\n\nConfigure the poetry version used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/release.yml@v0.5.2\n    with:\n      poetry-version: \"2.3.2\"\n```\n\n---\n\n#### `python-version`\n\nConfigure the python version used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/release.yml@v0.5.2\n    with:\n      python-version: \"3.14\"\n```\n\n---\n\n#### `os`\n\nConfigure the operating system used in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/release.yml@v0.5.2\n    with:\n      os: \"ubuntu-latest\"\n```\n\n---\n\n#### `env`\n\nEnvironment variables to set in the pipeline.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/release.yml@v0.5.2\n    with:\n      env: '{\"FOO\": \"bar\"}'\n```\n\n---\n\n#### `submodules`\n\nShould submodules be checked out with the repository?\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      submodules: false\n```\n\n---\n\n#### `fetch-depth`\n\nHow many commit to fetch from the branch history?\nIf set to 0, every commit is fetched.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      fetch-depth: 1\n```\n\n---\n\n### Pull request approval pipeline\n\nThis pipeline can be used to automatically approve pull request by some users.\nBy default, it is set to approve pull requests by the [dependabot] and\n[pre-commit.ci] bots.\n\nTo set up the pipeline, add a `yml` file to `./.github/workflows/`\nwith the following job configuration.\n\n```yaml\nname: Auto approve PRs\n\non: \n  pull_request_target:\n\njobs:\n  approve:\n    permissions:\n      pull-requests: write\n      contents: write\n    uses: MrThearMan/CI/.github/workflows/approve.yml@v0.5.2\n```\n\nThis job can take a number of inputs via the [with]-keyword.\n\n---\n\n#### `users`\n\nConfigure the users whose pull requests can be automatically approved.\n\nDefault configuration:\n\n```yaml\njobs:\n  approve:\n    uses: MrThearMan/CI/.github/workflows/approve.yml@v0.5.2\n    with:\n      users: '[\"dependabot[bot]\", \"pre-commit-ci[bot]\"]'\n```\n\n---\n\n#### `submodules`\n\nShould submodules be checked out with the repository?\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      submodules: false\n```\n\n---\n\n#### `fetch-depth`\n\nHow many commit to fetch from the branch history?\nIf set to 0, every commit is fetched.\n\nDefault configuration:\n\n```yaml\njobs:\n  test:\n    uses: MrThearMan/CI/.github/workflows/test-nox.yml@v0.5.2\n    with:\n      fetch-depth: 1\n```\n\n---\n\n## Pipeline hooks\n\nSome of the pipeline templates have hooks that can be defined\nto run additional setup and postprocessing steps if necessary.\nTo enable them, simply add a `yaml` file to the appropriate directory\nin your project and write a [composite action]. Here is a template for one.\n\n```yaml\nruns:\n  using: composite\n  \n  steps:\n    - name: \"Setup\"\n      shell: bash\n      run: ...\n```\n\n\u003e Here is a little trick you can do to pass the inputs from \n\u003e the testing job to the composite action when needed\n\u003e \n\u003e ```yaml\n\u003e inputs:\n\u003e   python-version:\n\u003e     default: ${{ matrix.python-version }}\n\u003e ```\n\nFor the testing pipeline, the hooks are:\n\n- `Pre-test`: Add the file `.github/actions/pre-test/action.yml`\n- `Post-test`: Add the file `.github/actions/post-test/action.yml`\n\nFor the release pipeline, the hooks are:\n\n- `Pre-release`: Add the file `.github/actions/pre-release/action.yml`\n- `Post-release`: Add the file `.github/actions/post-release/action.yml`\n\n---\n\n## Extra actions\n\n### Poetry install action\n\nInstalls poetry to the current python version, e.g., if used after \n`actions/setup-python`, poetry is installed with that python version.\n\n```yaml\njobs:\n  \u003cfoo\u003e:\n    steps:\n      - ...\n      - uses: MrThearMan/CI/.github/actions/poetry@v0.5.2\n        with:\n          os: \"ubuntu-latest\"\n          poetry-version: \"2.3.2\"\n```\n\nHowever, `actions/setup-python` [poetry caching] cannot be used if poetry is not installed.\nIn this case, a custom cache must be created:\n\n```yaml\njobs:\n  \u003cfoo\u003e:\n    steps:\n      - ...\n      - name: \"Load cached poetry environment\"\n        uses: actions/cache@v5\n        with:\n          path: .venv\n          key: \u003cunique-key-per-env\u003e\n```\n\n### Git changed filetypes\n\n\u003e Not tested yet.\n\nCan be used to check if certain filetypes were changed in a pull request.\n\n```yaml\njobs:\n  \u003cfoo\u003e:\n    steps:\n      - uses: MrThearMan/CI/.github/actions/get-changed-filetypes@v0.5.2\n        id: changed\n        with:\n          filetypes: \"py|yaml\"\n      - if: ${{ changed.changed-filetypes }}\n```\n\n\n[poetry]: https://python-poetry.org/\n[tox]: https://tox.wiki/en/latest/\n[coverage]: https://coverage.readthedocs.io/en/latest/\n[coveralls]: https://docs.coveralls.io/\n[coveralls-python]: https://github.com/TheKevJames/coveralls-python\n[mkdocs]: https://www.mkdocs.org/\n[PyPI]: https://pypi.org/\n[with]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith\n[environments]: https://tox.wiki/en/latest/config.html#envlist\n[parallel builds webhook]: https://docs.coveralls.io/parallel-build-webhook\n[job stategy matrix]: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs\n[yaml flow style]: https://yaml.org/spec/1.2.2/#chapter-7-flow-style-productions\n[GitHub pages]: https://pages.github.com/\n[pypi token]: https://pypi.org/help/#apitoken\n[actions secrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository\n[version]: https://python-poetry.org/docs/pyproject#version\n[composite action]: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action\n[poetry caching]: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages\n[dependabot]: https://github.com/dependabot\n[pre-commit.ci]: https://github.com/apps/pre-commit-ci\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrthearman%2Fci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrthearman%2Fci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrthearman%2Fci/lists"}