-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3737 from snapcore/main-merge
7.0
- Loading branch information
Showing
766 changed files
with
25,034 additions
and
12,856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? | ||
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? | ||
- [ ] Have you successfully run `./runtests.sh static`? | ||
- [ ] Have you successfully run `./runtests.sh tests/unit`? | ||
- [ ] Have you successfully run `make lint`? | ||
- [ ] Have you successfully run `pytest tests/unit`? | ||
|
||
----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,89 @@ | ||
name: Python Environment Tests | ||
on: [pull_request, push] | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "snapcraft/7.0" | ||
- "release/*" | ||
pull_request: | ||
|
||
jobs: | ||
static-and-unit-tests: | ||
linters: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
./tools/environment-setup-local.sh | ||
sudo apt update | ||
sudo apt install -y libapt-pkg-dev libyaml-dev xdelta3 shellcheck | ||
pip install -U -r requirements.txt -r requirements-devel.txt | ||
pip install . | ||
- name: Run black | ||
run: | | ||
make test-black | ||
- name: Run codespell | ||
run: | | ||
source ${HOME}/.venv/snapcraft/bin/activate | ||
make test-codespell | ||
- name: Run flake8 | ||
run: | | ||
source ${HOME}/.venv/snapcraft/bin/activate | ||
make test-flake8 | ||
- name: Run isort | ||
run: | | ||
make test-isort | ||
- name: Run mypy | ||
run: | | ||
source ${HOME}/.venv/snapcraft/bin/activate | ||
make test-mypy | ||
- name: Run pydocstyle | ||
run: | | ||
make test-pydocstyle | ||
- name: Run pyright | ||
run: | | ||
sudo snap install --classic node | ||
sudo snap install --classic pyright | ||
make test-pyright | ||
- name: Run pylint | ||
env: | ||
SNAPCRAFT_IGNORE_YAML_BINDINGS: "1" | ||
run: | | ||
make test-pylint | ||
- name: Run shellcheck | ||
run: | | ||
make test-shellcheck | ||
tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.10"] | ||
|
||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y libapt-pkg-dev libyaml-dev xdelta3 shellcheck | ||
pip install -U wheel setuptools pip | ||
pip install -U -r requirements.txt -r requirements-devel.txt | ||
pip install . | ||
- name: Run unit tests | ||
env: | ||
SNAPCRAFT_IGNORE_YAML_BINDINGS: "1" | ||
run: | | ||
source ${HOME}/.venv/snapcraft/bin/activate | ||
make test-units | ||
- name: Upload code coverage | ||
uses: codecov/codecov-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,65 @@ | ||
SOURCES=setup.py snapcraft tests/*.py tests/unit | ||
|
||
.PHONY: autoformat-black | ||
autoformat-black: | ||
black . | ||
black $(SOURCES) | ||
|
||
.PHONY: freeze-requirements | ||
freeze-requirements: | ||
tools/freeze-requirements.sh | ||
|
||
.PHONY: test-black | ||
test-black: | ||
black --check --diff . | ||
black --check --diff $(SOURCES) | ||
|
||
.PHONY: test-codespell | ||
test-codespell: | ||
codespell --quiet-level 4 --ignore-words-list crate,keyserver --skip '*.tar,*.xz,*.zip,*.bz2,*.7z,*.gz,*.deb,*.rpm,*.snap,*.gpg,*.pyc,*.png,*.ico,*.jar,changelog,.git,.hg,.mypy_cache,.tox,.venv,_build,buck-out,__pycache__,build,dist,.vscode,parts,stage,prime,test_appstream.py,./snapcraft.spec,./.direnv,./.pytest_cache' | ||
codespell --quiet-level 4 --ignore-words-list crate,keyserver,comandos --skip '*.tar,*.xz,*.zip,*.bz2,*.7z,*.gz,*.deb,*.rpm,*.snap,*.gpg,*.pyc,*.png,*.ico,*.jar,*.so,changelog,.git,.hg,.mypy_cache,.tox,.venv,_build,buck-out,__pycache__,build,dist,.vscode,parts,stage,prime,test_appstream.py,./snapcraft.spec,./.direnv,./.pytest_cache' | ||
|
||
.PHONY: test-flake8 | ||
test-flake8: | ||
python3 -m flake8 . | ||
python3 -m flake8 $(SOURCES) | ||
|
||
.PHONY: test-isort | ||
test-isort: | ||
isort --check $(SOURCES) | ||
|
||
.PHONY: test-mypy | ||
test-mypy: | ||
mypy . | ||
mypy $(SOURCES) | ||
|
||
.PHONY: test-pydocstyle | ||
test-pydocstyle: | ||
pydocstyle snapcraft | ||
|
||
.PHONY: test-pylint | ||
test-pylint: | ||
pylint snapcraft | ||
pylint tests/*.py tests/unit --disable=invalid-name,missing-module-docstring,missing-function-docstring,no-self-use,duplicate-code,protected-access,unspecified-encoding,too-many-public-methods,too-many-arguments | ||
|
||
.PHONY: test-pyright | ||
test-pyright: | ||
pyright $(SOURCES) | ||
|
||
.PHONY: test-shellcheck | ||
test-shellcheck: | ||
# Skip third-party gradlew script. | ||
find . \( -name .git -o -name gradlew \) -prune -o -print0 | xargs -0 file -N | grep shell.script | cut -f1 -d: | xargs shellcheck | ||
./tools/spread-shellcheck.py spread.yaml tests/spread/ | ||
|
||
.PHONY: test-legacy-units | ||
test-legacy-units: | ||
pytest --cov-report=xml --cov=snapcraft tests/legacy/unit | ||
|
||
.PHONY: test-units | ||
test-units: | ||
test-units: test-legacy-units | ||
pytest --cov-report=xml --cov=snapcraft tests/unit | ||
|
||
.PHONY: tests | ||
tests: tests-static test-units | ||
|
||
.PHONY: tests-static | ||
tests-static: test-black test-codespell test-flake8 test-mypy test-shellcheck | ||
tests-static: test-black test-codespell test-flake8 test-isort test-mypy test-pydocstyle test-pyright test-pylint test-shellcheck | ||
|
||
.PHONY: lint | ||
lint: tests-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.