mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-04-26 19:33:45 +03:00
Merge pull request #3066 from arnav13081994/update_cicd
This commit is contained in:
commit
e4ce5c5f2a
|
@ -234,7 +234,7 @@ def test_gitlab_invokes_flake8_and_pytest(
|
||||||
("y", "docker-compose -f local.yml exec -T django pytest"),
|
("y", "docker-compose -f local.yml exec -T django pytest"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_github_invokes_flake8_and_pytest(
|
def test_github_invokes_linter_and_pytest(
|
||||||
cookies, context, use_docker, expected_test_script
|
cookies, context, use_docker, expected_test_script
|
||||||
):
|
):
|
||||||
context.update({"ci_tool": "Github", "use_docker": use_docker})
|
context.update({"ci_tool": "Github", "use_docker": use_docker})
|
||||||
|
@ -248,11 +248,11 @@ def test_github_invokes_flake8_and_pytest(
|
||||||
with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml:
|
with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml:
|
||||||
try:
|
try:
|
||||||
github_config = yaml.safe_load(github_yml)
|
github_config = yaml.safe_load(github_yml)
|
||||||
flake8_present = False
|
linter_present = False
|
||||||
for action_step in github_config["jobs"]["flake8"]["steps"]:
|
for action_step in github_config["jobs"]["linter"]["steps"]:
|
||||||
if action_step.get("run") == "flake8":
|
if action_step.get("uses", "NA").startswith("pre-commit"):
|
||||||
flake8_present = True
|
linter_present = True
|
||||||
assert flake8_present
|
assert linter_present
|
||||||
|
|
||||||
expected_test_script_present = False
|
expected_test_script_present = False
|
||||||
for action_step in github_config["jobs"]["pytest"]["steps"]:
|
for action_step in github_config["jobs"]["pytest"]["steps"]:
|
||||||
|
|
|
@ -16,7 +16,7 @@ on:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
flake8:
|
linter:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
@ -28,13 +28,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
|
|
||||||
- name: Install flake8
|
# Run all pre-commit hooks on all the files.
|
||||||
run: |
|
# Getting only staged files can be tricky in case a new PR is opened
|
||||||
python -m pip install --upgrade pip
|
# since the action is run on a branch in detached head state
|
||||||
pip install flake8
|
- name: Install and Run Pre-commit
|
||||||
|
uses: pre-commit/action@v2.0.0
|
||||||
- name: Lint with flake8
|
|
||||||
run: flake8
|
|
||||||
|
|
||||||
# With no caching at all the entire ci process takes 4m 30s to complete!
|
# With no caching at all the entire ci process takes 4m 30s to complete!
|
||||||
pytest:
|
pytest:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user