Skip to content

Commit 4f820b4

Browse files
committed
Include python 3.8 i ci test runs & optimise CI and make config
1 parent 75a4c23 commit 4f820b4

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

.github/workflows/ci.yml

+26-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ jobs:
1010
name: Consult black on python formatting
1111

1212
steps:
13-
- uses: actions/checkout@v1
14-
- uses: actions/setup-python@v1
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
1515
with:
1616
python-version: 3.7
1717
- uses: Gr1N/setup-poetry@v2
18+
- uses: actions/cache@v2
19+
with:
20+
path: ~/.cache/pypoetry/virtualenvs
21+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
22+
restore-keys: |
23+
${{ runner.os }}-poetry-
1824
- name: Install dependencies
1925
run: poetry install
2026
- name: Run black
@@ -25,25 +31,37 @@ jobs:
2531

2632
name: Run tests with tox
2733

34+
strategy:
35+
matrix:
36+
python-version: [ '3.6', '3.7', '3.8']
37+
2838
steps:
29-
- uses: actions/checkout@v1
30-
- uses: actions/setup-python@v1
39+
- uses: actions/checkout@v2
40+
- uses: actions/setup-python@v2
3141
with:
32-
python-version: 3.7
42+
python-version: ${{ matrix.python-version }}
3343
- uses: Gr1N/setup-poetry@v2
44+
- uses: actions/cache@v2
45+
with:
46+
path: ~/.cache/pypoetry/virtualenvs
47+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-poetry-
3450
- name: Install dependencies
3551
run: |
3652
sudo apt install protobuf-compiler libprotobuf-dev
3753
poetry install
3854
- name: Run tests
39-
run: make full-test
55+
run: |
56+
make generate
57+
make test
4058
4159
build-release:
4260
runs-on: ubuntu-latest
4361

4462
steps:
45-
- uses: actions/checkout@v1
46-
- uses: actions/setup-python@v1
63+
- uses: actions/checkout@v2
64+
- uses: actions/setup-python@v2
4765
with:
4866
python-version: 3.7
4967
- uses: Gr1N/setup-poetry@v2

Makefile

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
help: ## - Show this help.
1+
.PHONY: help setup generate test types format clean plugin full-test check-style
2+
3+
help: ## - Show this help.
24
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
35

46
# Dev workflow tasks
57

68
generate: ## - Generate test cases (do this once before running test)
79
poetry run ./betterproto/tests/generate.py
810

9-
test: ## - Run tests
11+
test: ## - Run tests
1012
poetry run pytest --cov betterproto
1113

12-
types: ## - Check types with mypy
14+
types: ## - Check types with mypy
1315
poetry run mypy betterproto --ignore-missing-imports
1416

15-
format: ## - Apply black formatting to source code
17+
format: ## - Apply black formatting to source code
1618
poetry run black . --exclude tests/output_
1719

18-
clean: ## - Clean out generated files from the workspace
20+
clean: ## - Clean out generated files from the workspace
1921
rm -rf .coverage \
2022
.mypy_cache \
2123
.pytest_cache \
@@ -27,14 +29,14 @@ clean: ## - Clean out generated files from the workspace
2729

2830
# By default write plugin output to a directory called output
2931
o=output
30-
plugin: ## - Execute the protoc plugin, with output writte to `output` or the value passed to `-o`
32+
plugin: ## - Execute the protoc plugin, with output write to `output` or the value passed to `-o`
3133
mkdir -p $(o)
3234
protoc --plugin=protoc-gen-custom=betterproto/plugin.py $(i) --custom_out=$(o)
3335

3436
# CI tasks
3537

36-
full-test: generate ## - Run full testing sequence
38+
full-test: generate ## - Run full testing sequence with multiple pythons
3739
poetry run tox
3840

39-
check-style: ## - Check if code style is correct
41+
check-style: ## - Check if code style is correct
4042
poetry run black . --check --diff --exclude tests/output_

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,9 @@ Custom tests are found in `tests/test_*.py` and are run with pytest.
351351
Here's how to run the tests.
352352

353353
```sh
354-
# Generate assets from sample .proto files
354+
# Generate assets from sample .proto files required by the tests
355355
make generate
356-
357-
# Run all tests
356+
# Run the tests
358357
make test
359358
```
360359

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ omit = ["betterproto/tests/*"]
4747
legacy_tox_ini = """
4848
[tox]
4949
isolated_build = true
50-
envlist = py36, py37
50+
envlist = py36, py37, py38
5151
5252
[testenv]
5353
whitelist_externals = poetry

0 commit comments

Comments
 (0)