Skip to content

Commit

Permalink
Merge pull request #23 from qtc-de/develop
Browse files Browse the repository at this point in the history
Prepare v1.13.0 Release
  • Loading branch information
qtc-de authored Jun 26, 2024
2 parents b3aeabe + a9243a3 commit c2745d9
Show file tree
Hide file tree
Showing 20 changed files with 437 additions and 169 deletions.
82 changes: 41 additions & 41 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
name: develop Python CI
name: develop

on:
push:
branches:
- develop
pull_request:
branches:
- develop
paths:
- pyproject.toml
- tricot/**
- tests/**
- .github/workflows/develop.yml

jobs:
build:

build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 pytest requests
if [ -f requirements.txt ]; then pip install --upgrade --upgrade-strategy eager -r requirements.txt; fi
python setup.py sdist
pip install dist/*
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude __init__.py,conftest.py \
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude __init__.py,conftest.py
- name: Test with pytest
run: |
pytest tests/pytest
- name: Test with tricot
run: |
tricot tests/tricot/tricot.yml
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install --upgrade pipx
pipx install flake8
pipx install pytest
pipx install .
pipx inject pytest .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude __init__.py,conftest.py \
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude __init__.py,conftest.py
- name: Test with pytest
run: |
pytest tests/pytest
- name: Test with tricot
run: |
tricot tests/tricot/tricot.yml
82 changes: 41 additions & 41 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
name: main Python CI
name: main

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- pyproject.toml
- tricot/**
- tests/**
- .github/workflows/develop.yml

jobs:
build:

build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 pytest requests
if [ -f requirements.txt ]; then pip install --upgrade --upgrade-strategy eager -r requirements.txt; fi
python setup.py sdist
pip install dist/*
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude __init__.py,conftest.py \
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude __init__.py,conftest.py
- name: Test with pytest
run: |
pytest tests/pytest
- name: Test with tricot
run: |
tricot tests/tricot/tricot.yml
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install --upgrade pipx
pipx install flake8
pipx install pytest
pipx install .
pipx inject pytest .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude __init__.py,conftest.py \
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude __init__.py,conftest.py
- name: Test with pytest
run: |
pytest tests/pytest
- name: Test with tricot
run: |
tricot tests/tricot/tricot.yml
39 changes: 21 additions & 18 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@ on:
types: [created]

jobs:
deploy:

deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m build
python3 -m twine upload dist/*
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.13.0] - Jun 26, 2024

### Added

* Resource based requirements ([docs](/docs/README.md#external-requirements))

### Changed

* Expand `~` in file based validators
* Refactor CI pipeline
* Switch to `pyproject.toml`


## [1.12.0] - Dec 31, 2022

### Changed
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ to execute along with a set of desired validators. This approach makes *tricot*
for end to end testing of command line applications.


![](https://github.com/qtc-de/tricot/workflows/main%20Python%20CI/badge.svg?branch=main)
![](https://github.com/qtc-de/tricot/workflows/develop%20Python%20CI/badge.svg?branch=develop)
[![](https://img.shields.io/badge/version-1.12.0-blue)](https://github.com/qtc-de/tricot/releases)
![](https://github.com/qtc-de/tricot/workflows/main/badge.svg?branch=main)
![](https://github.com/qtc-de/tricot/workflows/develop/badge.svg?branch=develop)
[![](https://img.shields.io/badge/version-1.13.0-blue)](https://github.com/qtc-de/tricot/releases)
[![](https://img.shields.io/badge/packaging-pypi-blue)](https://pypi.org/project/tricot/)
![](https://img.shields.io/badge/python-9%2b-blue)
[![](https://img.shields.io/badge/license-GPL%20v3.0-blue)](https://github.com/qtc-de/tricot/blob/master/LICENSE)

Expand All @@ -22,20 +23,19 @@ https://user-images.githubusercontent.com/49147108/183279190-d4148edb-ce40-443c-

----

*tricot* can be build and installed as a *pip package*. The following command installs *tricot*
for your current user profile:
*tricot* can be build and installed as a [pip package](https://pypi.org/project/tricot/). The recommended
way of installing is via [pipx](https://github.com/pypa/pipx):

```console
$ pip3 install tricot
[user@host ~]$ pipx install tricot
```

You can also build *tricot* from source by running the following commands:

```console
$ git clone https://github.com/qtc-de/tricot
$ cd tricot
$ python3 setup.py sdist
$ pip3 install dist/*
[user@host ~]$ git clone https://github.com/qtc-de/tricot
[user@host ~]$ cd tricot
[user@host ~/tricot]$ pipx install .
```

*tricot* also supports autocompletion for *bash*. To take advantage of autocompletion, you need to have the
Expand All @@ -44,7 +44,7 @@ copying the [completion script](./resources/bash_completion.d/tricot) to your ``
autocompletion.

```console
$ cp resources/bash_completion.d/tricot ~/bash_completion.d/
[user@host ~]$ cp resources/bash_completion.d/tricot ~/bash_completion.d/
```


Expand Down
13 changes: 10 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,8 @@ This is also true, even if the corresponding *test* or *tester* run was successf
across different platforms. To prevent errors at runtime, you can specify some of the external requirements
within your test configuration. *tricot* checks these requirements first before running the tests. Currently,
you can require certain files to exist, certain commands to exist and a specific version of tricot to run the
test. All this needs to be configured within the tester configuration:
test. All this needs to be configured within the tester configuration. By using the `url` key, resources can
even be downloaded dynamically during runtime.

```yaml
tester:
Expand All @@ -822,8 +823,14 @@ tester:
requires:
files:
- /etc/passwd
- path: ~/.local/bin/tool
url: https://where-to-download-tool-from.com/tool.jar
hash:
sha256: e81fb3d921d12bc4ef9d2292d1f2082386e48ffe8b1269c0d846ce17f56e9da8
mode: 0o755
commands:
- cat
- tool
tricot:
eq: 1.9.0
le: 1.9.0
Expand All @@ -832,7 +839,7 @@ tester:
gt: 1.9.0
```

File based requirements can also include a checksum for the specified file:
File based requirements support different checksum types:

```yaml
tester:
Expand All @@ -842,7 +849,7 @@ tester:
requires:
files:
- filename: /etc/passwd
- path: /etc/passwd
md5: c6beb132462d61bdd851de604acec9c7
sha1: 6de989b32cb10f2361ddaa46ea917a674429b4c6
sha256: f5aa7815387c6f8bad54554b5632a775f9c95cedcf4400b3f78395d4e2f59c0f
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ['hatchling']
build-backend = 'hatchling.build'

[project]
name = 'tricot'
version = '1.13.0'
dependencies = [
'PyYAML',
'termcolor',
'docker',
]
requires-python = '>=3.9'
authors = [
{name = 'Tobias Neitzel (@qtc_de)'},
]
maintainers = [
{name = 'Tobias Neitzel (@qtc_de)'}
]
description = 'Trivial Command Testser'
readme = 'README.md'
license = {file = 'LICENSE'}
keywords = ['testing', 'validation', 'test-automation', 'end-to-end-testing', 'testing-framework']
classifiers = [
'Programming Language :: Python :: 3',
'Operating System :: Unix',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
]

[project.urls]
Homepage = 'https://github.com/qtc-de/tricot'
Documentation = 'https://github.com/qtc-de/tricot/tree/main/docs'
Repository = 'https://github.com/qtc-de/tricot'
'Bug Tracker' = 'https://github.com/qtc-de/tricot/issues'
Changelog = 'https://github.com/qtc-de/tricot/blob/main/CHANGELOG.md'

[project.scripts]
tricot = 'tricot.main:main'
Loading

0 comments on commit c2745d9

Please sign in to comment.