Skip to content

Commit

Permalink
ci: use starflow CI actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Oct 22, 2024
1 parent 9027b2c commit dff7074
Show file tree
Hide file tree
Showing 9 changed files with 1,990 additions and 434 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/docs.yaml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: QA
on:
push:
branches:
- "main"
- "feature/*"
- "hotfix/*"
- "release/*"
- "renovate/*"
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lengau/starflow/lint@work/CRAFT-3602/test-action
unit-tests:
strategy:
matrix:
platform:
- ubuntu-latest
- [noble, arm64] # Self-hosted Ubuntu Noble runner to test arm64
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: lengau/starflow/test-python@work/CRAFT-3602/test-action
with:
python-versions: 3.10 3.11 3.12 3.13
tics-token: ${{ secrets.TICSAUTHTOKEN }}
integration-tests:
strategy:
matrix:
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: lengau/starflow/test-python@work/CRAFT-3602/test-action
with:
python-versions: 3.10 3.12
target: test-integration
lowest-tests: # Run unit and integration tests on the oldest Python available with UV
runs-on: ubuntu-latest
env:
UV_RESOLUTION: lowest
steps:
- uses: actions/checkout@v4
- uses: lengau/starflow/test-python@work/CRAFT-3602/test-action
with:
python-versions: "3.10"
128 changes: 0 additions & 128 deletions .github/workflows/tests.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
#formats:
# formats:
# - pdf
# - epub

Expand Down
84 changes: 18 additions & 66 deletions HACKING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,33 @@ repository. Once you've done that, clone the project to your computer using git
clone's ``--recurse-submodules`` parameter. (See more on the `git submodules`_
documentation.)

Tooling
=======
We use a large number of tools for our project. Most of these are installed for
you with tox, but you'll need to install:

- Python 3.8 (default on Ubuntu 20.04, available on Ubuntu 22.04 through the
deadsnakes_ PPA) with setuptools.
- tox_ version 3.8 or later
- ShellCheck_ (also available via snap: ``snap install shellcheck``)
- Codespell_ (also available via snap: ``snap install codespell``)
- ruff_ (also available via snap: ``snap install ruff``)

Once you have all of those installed, you can install the necessary virtual
environments for this repository using tox.

Other tools
###########
Some other tools we use for code quality include:

- Black_ for code formatting
- pytest_ for testing

A complete list is kept in our pyproject.toml_ file in dev dependencies.

Initial Setup
#############
To set up a development environment, run::

After cloning the repository but before making any changes, it's worth ensuring
that the tests, linting and tools all run on your machine. Running ``tox`` with
no parameters will create the necessary virtual environments for linting and
testing and run those::
make setup

tox
To test that the environment works, run::

If you want to install the environments but not run the tests, you can run::
make lint
make test

tox --notest

If you'd like to run the tests with a newer version of Python, you can pass a
specific environment. You must have an appropriately versioned Python
interpreter installed. For example, to run with Python 3.10, run::

tox -e test-py3.10

While the use of pre-commit_ is optional, it is highly encouraged, as it runs
automatic fixes for files when ``git commit`` is called, including code
formatting with ``black`` and ``ruff``. The versions available in ``apt`` from
Debian 11 (bullseye), Ubuntu 22.04 (jammy) and newer are sufficient, but you can
also install the latest with ``pip install pre-commit``. Once you've installed
it, run ``pre-commit install`` in this git repository to install the pre-commit
hooks.

Tox environments and labels
###########################

We group tox environments with the following labels:
Code conventions
================

* ``format``: Runs all code formatters with auto-fixing
* ``type``: Runs all type checkers
* ``lint``: Runs all linters (including type checkers)
* ``unit-tests``: Runs unit tests in several supported Python versions
* ``integration-tests``: Run integration tests in several Python versions
* ``tests``: The union of ``unit-tests`` and ``integration-tests``
Several targets exist in the Makefile to help with code conventions. They are all
merged into the ``format`` target for automatic formatting and the ``lint`` target
for running all linters. These conventions apply to all files in the repository,
including documentation and metadata files. ``pre-commit`` is used for running many
hooks before committing. Run::

For each of these, you can see which environments will be run with ``tox list``.
For example::
make setup-precommit

tox list -m lint
to configure it for this repository.

You can also see all the environments by simply running ``tox list``
Testing
=======

Running ``tox run -m format`` and ``tox run -m lint`` before committing code is
recommended.
Tests can be run using ``make test``, which will run all test forms. Specific types
of tests can be run with other testing targets shown in ``make help``.

Branches
--------
Expand Down Expand Up @@ -393,11 +347,9 @@ it includes the changes from 2.9.1.
3.0.1 includes changes from the 2.9.1 release.


.. _Black: https://black.readthedocs.io
.. _`Canonical contributor licence agreement`: http://www.ubuntu.com/legal/contributors/
.. _Codespell: https://github.com/codespell-project/codespell
.. _`conventional commit`: https://www.conventionalcommits.org/en/v1.0.0/#summary
.. _deadsnakes: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
.. _`git submodules`: https://git-scm.com/book/en/v2/Git-Tools-Submodules#_cloning_submodules
.. _`Martin Fowler's definition`: https://refactoring.com/
.. _OneFlow: https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow
Expand Down
Loading

0 comments on commit dff7074

Please sign in to comment.