Skip to content

Commit

Permalink
chore: new project abr-testing (#14707)
Browse files Browse the repository at this point in the history
Add a new project for ABR test files so they do not have to adhere to
the requirements that hardware-testing does, and vice versa.
  • Loading branch information
sfoster1 authored Mar 21, 2024
1 parent 3aa46e0 commit 910c886
Show file tree
Hide file tree
Showing 10 changed files with 622 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/abr-testing-lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow runs test and lint on branch pushes that touch the abr-testing
# project or its dependencies.

name: 'abr-testing lint/test'
on:
push:
paths:
- 'Makefile'
- 'abr-testing/**'
- 'scripts/**/*.mk'
- 'scripts/**/*.py'
- '.github/workflows/abr-testing-lint-test.yaml'
- '.github/actions/python/**'
branches:
- 'edge'
tags-ignore:
- '*'
pull_request:
paths:
- 'abr-testing/**'
- 'scripts/**/*.mk'
- 'scripts/**/*.py'
- '.github/workflows/abr-testing-lint-test.yaml'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.ref_name != 'edge' || github.run_id}}-${{ github.ref_type != 'tag' || github.run_id }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
lint-test:
runs-on: 'windows-latest'
steps:
- name: Checkout opentrons repo
uses: 'actions/checkout@v3'
with:
fetch-depth: 0
- name: Setup Node
uses: 'actions/setup-node@v3'
with:
node-version: '12'
- name: Setup Python
uses: 'actions/setup-python@v4'
with:
python-version: '3.10'
- name: Set up abr-testing project
uses: './.github/actions/python/setup'
with:
project: 'abr-testing'
- name: lint
run:
make -C abr-testing lint
- name: test
run:
make -C abr-testing test
24 changes: 24 additions & 0 deletions abr-testing/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[flake8]

# set line-length for future black support
# https://github.com/psf/black/blob/master/docs/compatible_configs.md
max-line-length = 100

# max cyclomatic complexity
# NOTE: (andy s) increasing this from 9 to 15 b/c test scripts often handle all logic in main
max-complexity = 15

extend-ignore =
# ignore E203 because black might reformat it
E203,
# do not require type annotations for self nor cls
ANN101,
ANN102

# configure flake8-docstrings
# https://pypi.org/project/flake8-docstrings/
docstring-convention = google

noqa-require-code = true

# per-file-ignores =
80 changes: 80 additions & 0 deletions abr-testing/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
include ../scripts/push.mk
include ../scripts/python.mk

SHX := npx shx

ot_project := $(OPENTRONS_PROJECT)
project_rs_default = $(if $(ot_project),$(ot_project),robot-stack)
project_ir_default = $(if $(ot_project),$(ot_project),ot3)

package_name = abr_testing
package_version = $(call python_package_version,abr-testing,$(project_rs_default))
wheel_file = dist/$(call python_get_wheelname,abr-testing,$(project_rs_default),$(package_name),$(BUILD_NUMBER))
sdist_file = dist/$(call python_get_sdistname,abr-testing,$(project_rs_default),$(package_name))

tests ?= tests
test_opts ?=

# Host key location for robot
ssh_key ?= $(default_ssh_key)
# Other SSH args for robot
ssh_opts ?= $(default_ssh_opts)
# Helper to safely bundle ssh options
ssh_helper = $(if $(ssh_key),-i $(ssh_key)) $(ssh_opts)
ssh_helper_ot3 = $(ssh_helper) -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa

# Source discovery
# For the python sources
ot_py_sources := $(filter %.py,$(shell $(SHX) find abr_testing/))
ot_sources := $(ot_py_sources)

# Defined separately than the clean target so the wheel file doesn’t have to
# depend on a PHONY target
clean_cmd = $(SHX) rm -rf build dist .coverage coverage.xml '*.egg-info' '**/__pycache__' '**/*.pyc' '**/.mypy_cache'


.PHONY: all
all: clean sdist wheel

.PHONY: setup
setup:
$(pipenv) sync $(pipenv_opts)
$(pipenv) run pip freeze

.PHONY: teardown
teardown:
$(pipenv) --rm

.PHONY: clean
clean:
$(clean_cmd)

.PHONY: wheel
wheel: export OPENTRONS_PROJECT=$(project_rs_default)
wheel:
rm -rf dist/*.whl
$(python) setup.py $(wheel_opts) bdist_wheel
$(SHX) rm -rf build
$(SHX) ls dist

.PHONY: sdist
sdist: export OPENTRONS_PROJECT=$(project_rs_default)
sdist:
$(clean_cmd)
$(python) setup.py sdist
$(SHX) rm -rf build
$(SHX) ls dist

.PHONY: lint
lint:
$(python) -m mypy abr_testing tests
$(python) -m black --check abr_testing tests setup.py
$(python) -m flake8 abr_testing tests setup.py

.PHONY: format
format:
$(python) -m black abr_testing tests setup.py

.PHONY: test
test:
@echo "No tests yet"
24 changes: 24 additions & 0 deletions abr-testing/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
abr-testing = { editable = true, path = "." }

[dev-packages]
atomicwrites = "==1.4.1"
colorama = "==0.4.4"
pytest = "==7.1.1"
pytest-cov = "==2.10.1"
mypy = "==0.981"
black = "==22.3.0"
flake8 = "~=3.9.0"
flake8-annotations = "~=2.6.2"
flake8-docstrings = "~=1.6.0"
flake8-noqa = "~=1.2.1"
requests = "==2.27.1"
types-requests = "==2.25.6"

[requires]
python_version = "3.10"
Loading

0 comments on commit 910c886

Please sign in to comment.