Skip to content

Commit 4f5d9aa

Browse files
authored
Merge pull request #534 from Josverl/dev/CLI-prompter
Dev/cli prompter
2 parents 579ce2a + 70d490e commit 4f5d9aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1690
-1177
lines changed

.actrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# set default options for running nekios act to run actions locally with docker
2+
# reus images to speed up builds and to be able to inspect the state after a build
3+
# bind the local folder to the docker container to avoid needing to copy files
4+
# use the large images to include as many tools as possible from ghcr.io/catthehacker/ubuntu:full-latest
5+
--reuse
6+
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest
7+
--action-offline-mode
8+
--bind

.github/codecov.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,31 @@ coverage:
44
patch:
55
default:
66
target: 80%
7+
8+
codecov:
9+
branch: main
10+
11+
12+
flag_management:
13+
default_rules: # the rules that will be followed for any flag added, generally
14+
carryforward: true
15+
statuses:
16+
- type: project
17+
target: auto
18+
threshold: 1%
19+
- type: patch
20+
target: 90%
21+
individual_flags: # exceptions to the default rules above, stated flag by flag
22+
- name: stubber
23+
paths:
24+
- src/stubber
25+
carryforward: true
26+
- name: mpflash
27+
paths:
28+
- src/mpflash
29+
carryforward: true
30+
statuses:
31+
- type: project
32+
target: 20%
33+
- type: patch
34+
target: 90%

.github/workflows/pytest.yml

Lines changed: 117 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -2,119 +2,127 @@
22
# - test the workstation scripts
33
# - test the createstubs on multiple micropyton linux versions
44
# - test the minified createstubs on multiple micropyton linux versions
5+
6+
# - upload coverage stats to Codecov
7+
# - push coverage result to Testspace server
8+
# - upload artifacts from the results folder
59
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
610

7-
name: pytest
11+
name: pytest stubber
812
on:
9-
workflow_dispatch:
10-
pull_request:
11-
branches: [main]
12-
13-
push:
14-
branches: [main, dev/*, feat/*, fix/*]
15-
paths:
16-
- "src/**"
17-
- "tests/**"
18-
- "**/pyproject.toml"
19-
- "**/poetry.lock"
13+
workflow_dispatch:
14+
pull_request:
15+
branches: [main]
16+
17+
push:
18+
branches: [main, dev/*, feat/*, fix/*]
19+
paths:
20+
- .github/workflows/pytest.yml
21+
- "src/stubber/**"
22+
- "tests/**"
23+
- "**/pyproject.toml"
24+
- "**/poetry.lock"
25+
26+
env:
27+
JUPYTER_PLATFORM_DIRS: "1"
28+
# fix: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
2029

2130
concurrency:
22-
group: ${{ github.workflow }}-${{ github.ref }}
23-
cancel-in-progress: true
31+
group: ${{ github.workflow }}-${{ github.ref }}
32+
cancel-in-progress: true
2433

2534
jobs:
26-
run_tests:
27-
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
28-
runs-on: ${{ matrix.os }}
29-
env:
30-
JUPYTER_PLATFORM_DIRS: "1"
31-
# fix: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
32-
33-
strategy:
34-
fail-fast: false
35-
matrix:
36-
os: [ubuntu-latest, windows-latest, macos-latest]
37-
python-version: ["3.8", "3.9", "3.10", "3.11"]
38-
exclude:
39-
- os: macos-latest
40-
python-version: "3.9" # avoid black install problem for this version
41-
- os: macos-latest
42-
python-version: "3.10" # avoid black install problem for this version
43-
44-
steps:
45-
- name: Checkout repository
46-
uses: actions/checkout@v4
47-
with:
48-
fetch-depth: 0
49-
# Number of commits to fetch. 0 indicates all history for all branches and tags.
50-
51-
- uses: testspace-com/setup-testspace@v1
52-
with:
53-
domain: josverl
54-
55-
#----------------------------------------------
56-
# poetry is not in the default image
57-
#----------------------------------------------
58-
- name: Install poetry
59-
run: pipx install poetry==1.3.1
60-
61-
- name: Set up Python ${{ matrix.python-version }}
62-
uses: actions/setup-python@v5
63-
with:
64-
python-version: ${{ matrix.python-version }}
65-
cache: "poetry"
66-
67-
#----------------------------------------------
68-
# install project
69-
#----------------------------------------------
70-
- name: Install dependencies
71-
run: poetry install --with dev --no-interaction
72-
73-
#----------------------------------------------
74-
# stubber clone
75-
# repos needed for tests
76-
#----------------------------------------------
77-
- name: stubber clone
78-
run: poetry run stubber clone --add-stubs
79-
80-
- name: Test mpflash
81-
if: always()
82-
run: poetry run coverage run -m pytest -m "mpflash" --junitxml=results/mpflash-coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml
83-
84-
- name: Upload mpflash coverage.xml to Codecov
85-
if: always() # ignore previous error
86-
uses: codecov/codecov-action@v4
87-
with:
88-
file: results/results/mpflash-coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml
89-
flags: mpflash
90-
fail_ci_if_error: false
91-
92-
- name: Test stubber
93-
if: always()
94-
run: |
95-
# poetry run coverage erase
96-
poetry run coverage run -m pytest -m "stubber" --junitxml=results/stubber-coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml
97-
98-
- name: Upload stubber coverage.xml to Codecov
99-
if: always() # ignore previous error
100-
uses: codecov/codecov-action@v4
101-
with:
102-
file: results/stubber-coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml
103-
flags: stubber
104-
fail_ci_if_error: false
105-
106-
#----------------------------------------------
107-
# upload coverage stats
108-
# .XML to Codecov
109-
#----------------------------------------------
110-
111-
- name: Push result to Testspace server
112-
if: always() # ignore previous error
113-
run: |
114-
testspace [tests/${{ matrix.os }}/Python_${{ matrix.python-version }}]results/*.xml --link codecov
115-
116-
- uses: actions/upload-artifact@v4
117-
if: always() # ignore previous error
118-
with:
119-
path: results/
120-
name: results-${{ matrix.python-version }}-${{ matrix.os }}
35+
test_stubber:
36+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
37+
runs-on: ${{ matrix.os }}
38+
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os: [ubuntu-latest, windows-latest, macos-latest]
43+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
44+
include: # for testing
45+
- os: ubuntu-latest
46+
python-version: "3.10"
47+
exclude: # avoid black install problem for these versions on macos
48+
- os: macos-latest
49+
python-version: "3.9"
50+
- os: macos-latest
51+
python-version: "3.10"
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
# Number of commits to fetch. 0 indicates all history for all branches and tags.
59+
60+
- uses: testspace-com/setup-testspace@v1
61+
continue-on-error: true
62+
with:
63+
domain: josverl
64+
65+
#----------------------------------------------
66+
# poetry is not in the default image
67+
#----------------------------------------------
68+
- name: Install poetry
69+
run: pipx install poetry==1.3.1
70+
71+
- name: Set up Python ${{ matrix.python-version }}
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
# cache: "poetry"
76+
77+
#----------------------------------------------
78+
# install project
79+
#----------------------------------------------
80+
- name: Install test dependencies
81+
run: poetry install --with test
82+
83+
#----------------------------------------------
84+
# stubber clone
85+
# repos needed for tests
86+
#----------------------------------------------
87+
- name: stubber clone
88+
run: poetry run stubber clone --add-stubs
89+
90+
- name: Test stubber
91+
run: |
92+
poetry run coverage erase
93+
poetry run coverage run -m pytest -m stubber
94+
#----------------------------------------------
95+
# upload coverage stats
96+
# .XML to Codecov
97+
#----------------------------------------------
98+
99+
- name: create coverage report
100+
if: always()
101+
continue-on-error: true
102+
run: |
103+
poetry run coverage xml -o results/coverage-stubber-${{ matrix.python-version }}-${{ matrix.os }}.xml
104+
105+
- name: Upload coverage-stubber-*.xml to Codecov
106+
if: always() # ignore errors
107+
continue-on-error: true
108+
uses: codecov/codecov-action@v4
109+
with:
110+
file: results/coverage-stubber-${{ matrix.python-version }}-${{ matrix.os }}.xml
111+
flags: stubber
112+
token: ${{ secrets.CODECOV_TOKEN }}
113+
fail_ci_if_error: false
114+
115+
#----------------------------------------------
116+
117+
- name: Push result to Testspace server
118+
if: always() # ignore errors
119+
continue-on-error: true
120+
run: |
121+
testspace [tests/${{ matrix.os }}/Python_${{ matrix.python-version }}]results/*.xml --link codecov
122+
123+
- uses: actions/upload-artifact@v4
124+
if: always() # ignore errors
125+
continue-on-error: true
126+
with:
127+
path: results/
128+
name: results-stubber-${{ matrix.python-version }}-${{ matrix.os }}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# This workflow will :
2+
# - test mpflash
3+
# - upload coverage stats to Codecov
4+
# - push coverage result to Testspace server
5+
# - upload artifacts from the results folder
6+
7+
name: pytest mpflash
8+
on:
9+
workflow_dispatch:
10+
pull_request:
11+
branches: [main]
12+
13+
push:
14+
branches: [main, dev/*, feat/*, fix/*]
15+
paths:
16+
- .github/workflows/pytest_mpflash.yml
17+
- "src/mpflash/**"
18+
19+
env:
20+
JUPYTER_PLATFORM_DIRS: "1"
21+
# fix: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
test_mpflash:
29+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
30+
runs-on: ${{ matrix.os }}
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: [ubuntu-latest, windows-latest, macos-latest]
36+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
37+
include: # for testing
38+
- os: ubuntu-latest
39+
python-version: "3.10"
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Install testspace client
45+
continue-on-error: true
46+
uses: testspace-com/setup-testspace@v1
47+
with:
48+
domain: josverl
49+
50+
#----------------------------------------------
51+
# poetry is not in the default image
52+
#----------------------------------------------
53+
- name: Install poetry and codecov
54+
run: |
55+
pipx install poetry==1.3.1
56+
57+
- name: Set up Python ${{ matrix.python-version }}
58+
uses: actions/setup-python@v5
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
# cache: "poetry"
62+
63+
# #----------------------------------------------
64+
# # install project
65+
# #----------------------------------------------
66+
- name: Install mpflash & test dependencies
67+
working-directory: src/mpflash
68+
run: |
69+
poetry install --with test
70+
71+
- name: Test mpflash
72+
working-directory: src/mpflash
73+
run: |
74+
poetry run coverage erase
75+
poetry run coverage run -m pytest -m mpflash
76+
77+
- name: create coverage report
78+
if: always()
79+
continue-on-error: true
80+
working-directory: src/mpflash
81+
run: |
82+
poetry run coverage xml -o ../../results/coverage-mpflash-${{ matrix.python-version }}-${{ matrix.os }}.xml
83+
84+
# #----------------------------------------------
85+
# # upload coverage stats
86+
# # .XML to Codecov
87+
# #----------------------------------------------
88+
89+
- name: Upload coverage-mpflash-*.xml to Codecov
90+
if: always() # ignore errors
91+
continue-on-error: true
92+
uses: codecov/codecov-action@v4
93+
with:
94+
file: results/coverage-mpflash-${{ matrix.python-version }}-${{ matrix.os }}.xml
95+
flags: stubber
96+
token: ${{ secrets.CODECOV_TOKEN }}
97+
fail_ci_if_error: false
98+
99+
100+
- uses: actions/upload-artifact@v4
101+
if: always() # ignore errors
102+
continue-on-error: true
103+
with:
104+
path: results
105+
name: mpflash-coverage-mpflash-${{ matrix.python-version }}-${{ matrix.os }}
106+
107+
- name: Push coverage result to Testspace server
108+
if: always() # ignore errors
109+
continue-on-error: true
110+
run: |
111+
testspace [tests/${{ matrix.os }}/Python_${{ matrix.python-version }}]results/*.xml --link codecov

0 commit comments

Comments
 (0)