Skip to content

Commit dbc4ca9

Browse files
authored
Merge pull request #16 from fourstix/b_update_build
update workflows
2 parents b9bb85f + a8a86cf commit dbc4ca9

File tree

7 files changed

+218
-45
lines changed

7 files changed

+218
-45
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2021 Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
Thank you for contributing! Before you submit a pull request, please read the following.
6+
7+
Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html
8+
9+
If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs
10+
11+
Before submitting the pull request, make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code
12+
13+
Please remove all of this text before submitting. Include an explanation or list of changes included in your PR, as well as, if applicable, a link to any related issues.

.github/workflows/build.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Build CI
6+
7+
on: [pull_request, push]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Dump GitHub context
14+
env:
15+
GITHUB_CONTEXT: ${{ toJson(github) }}
16+
run: echo "$GITHUB_CONTEXT"
17+
- name: Translate Repo Name For Build Tools filename_prefix
18+
id: repo-name
19+
run: |
20+
echo ::set-output name=repo-name::$(
21+
echo ${{ github.repository }} |
22+
awk -F '\/' '{ print tolower($2) }' |
23+
tr '_' '-'
24+
)
25+
- name: Set up Python 3.7
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: 3.7
29+
- name: Versions
30+
run: |
31+
python3 --version
32+
- name: Checkout Current Repo
33+
uses: actions/checkout@v1
34+
with:
35+
submodules: true
36+
- name: Checkout tools repo
37+
uses: actions/checkout@v2
38+
with:
39+
repository: adafruit/actions-ci-circuitpython-libs
40+
path: actions-ci
41+
- name: Install dependencies
42+
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
43+
run: |
44+
source actions-ci/install.sh
45+
- name: Pip install pylint, Sphinx, pre-commit
46+
run: |
47+
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
48+
- name: Library version
49+
run: git describe --dirty --always --tags
50+
- name: Setup problem matchers
51+
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
52+
- name: Pre-commit hooks
53+
run: |
54+
pre-commit run --all-files
55+
- name: Build assets
56+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
57+
- name: Archive bundles
58+
uses: actions/upload-artifact@v2
59+
with:
60+
name: bundles
61+
path: ${{ github.workspace }}/bundles/
62+
- name: Check For docs folder
63+
id: need-docs
64+
run: |
65+
echo ::set-output name=docs::$( find . -wholename './docs' )
66+
- name: Build docs
67+
if: contains(steps.need-docs.outputs.docs, 'docs')
68+
working-directory: docs
69+
run: sphinx-build -E -W -b html . _build/html
70+
- name: Check For setup.py
71+
id: need-pypi
72+
run: |
73+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
74+
- name: Build Python package
75+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
76+
run: |
77+
pip install --upgrade setuptools wheel twine readme_renderer testresources
78+
python setup.py sdist
79+
python setup.py bdist_wheel --universal
80+
twine check dist/*
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2021 Scott Shawcroft for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Failure help text
6+
7+
on:
8+
workflow_run:
9+
workflows: ["Build CI"]
10+
types:
11+
- completed
12+
13+
jobs:
14+
post-help:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
17+
steps:
18+
- name: Post comment to help
19+
uses: adafruit/circuitpython-action-library-ci-failed@v1

.github/workflows/main.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Release Actions
6+
7+
on:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
upload-release-assets:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Dump GitHub context
16+
env:
17+
GITHUB_CONTEXT: ${{ toJson(github) }}
18+
run: echo "$GITHUB_CONTEXT"
19+
- name: Translate Repo Name For Build Tools filename_prefix
20+
id: repo-name
21+
run: |
22+
echo ::set-output name=repo-name::$(
23+
echo ${{ github.repository }} |
24+
awk -F '\/' '{ print tolower($2) }' |
25+
tr '_' '-'
26+
)
27+
- name: Set up Python 3.6
28+
uses: actions/setup-python@v1
29+
with:
30+
python-version: 3.6
31+
- name: Versions
32+
run: |
33+
python3 --version
34+
- name: Checkout Current Repo
35+
uses: actions/checkout@v1
36+
with:
37+
submodules: true
38+
- name: Checkout tools repo
39+
uses: actions/checkout@v2
40+
with:
41+
repository: adafruit/actions-ci-circuitpython-libs
42+
path: actions-ci
43+
- name: Install deps
44+
run: |
45+
source actions-ci/install.sh
46+
- name: Build assets
47+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
48+
- name: Upload Release Assets
49+
# the 'official' actions version does not yet support dynamically
50+
# supplying asset names to upload. @csexton's version chosen based on
51+
# discussion in the issue below, as its the simplest to implement and
52+
# allows for selecting files with a pattern.
53+
# https://github.com/actions/upload-release-asset/issues/4
54+
#uses: actions/[email protected]
55+
uses: csexton/release-asset-action@master
56+
with:
57+
pattern: "bundles/*"
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
60+
upload-pypi:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v1
64+
- name: Check For setup.py
65+
id: need-pypi
66+
run: |
67+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
68+
- name: Set up Python
69+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
70+
uses: actions/setup-python@v1
71+
with:
72+
python-version: '3.x'
73+
- name: Install dependencies
74+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install setuptools wheel twine
78+
- name: Build and publish
79+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
80+
env:
81+
TWINE_USERNAME: ${{ secrets.pypi_username }}
82+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
83+
run: |
84+
for file in $(find -not -path "./.*" -not -path "./docs*" -name "*.py"); do
85+
sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file;
86+
done;
87+
python setup.py sdist
88+
twine upload dist/*

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
*.mpy
26
.idea
37
__pycache__
48
_build
59
*.pyc
610
.env
7-
build*
11+
.python-version
12+
build*/
813
bundles
914
*.DS_Store
1015
.eggs
1116
dist
12-
**/*.egg-info
17+
**/*.egg-info
18+
.vscode

.pylintrc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
[MASTER]
26

37
# A comma-separated list of package or module names from where C extensions may
48
# be loaded. Extensions are loading into the active Python interpreter and may
59
# run arbitrary code
610
extension-pkg-whitelist=
711

8-
# Add files or directories to the blacklist. They should be base names, not
12+
# Add files or directories to the ignore-list. They should be base names, not
913
# paths.
1014
ignore=CVS
1115

12-
# Add files or directories matching the regex patterns to the blacklist. The
16+
# Add files or directories matching the regex patterns to the ignore-list. The
1317
# regex matches against base names, not paths.
1418
ignore-patterns=
1519

@@ -18,8 +22,7 @@ ignore-patterns=
1822
#init-hook=
1923

2024
# Use multiple processes to speed up Pylint.
21-
# jobs=1
22-
jobs=2
25+
jobs=1
2326

2427
# List of plugins (as comma separated values of python modules names) to load,
2528
# usually to register additional checkers.
@@ -52,7 +55,7 @@ confidence=
5255
# no Warning level messages displayed, use"--disable=all --enable=classes
5356
# --disable=W"
5457
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
55-
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error
58+
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement
5659

5760
# Enable the message, report, category or checker with the given id(s). You can
5861
# either give multiple identifier separated by comma (,) or put this option
@@ -246,10 +249,10 @@ ignore-comments=yes
246249
ignore-docstrings=yes
247250

248251
# Ignore imports when computing similarities.
249-
ignore-imports=no
252+
ignore-imports=yes
250253

251254
# Minimum lines number of a similarity.
252-
min-similarity-lines=4
255+
min-similarity-lines=12
253256

254257

255258
[BASIC]

0 commit comments

Comments
 (0)