Skip to content

Commit

Permalink
More lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bhati-pradeep committed Jan 4, 2024
1 parent 55e2b81 commit 6df92ef
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 143 deletions.
5 changes: 3 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
🐍 python:
- "**/*.py"
- "*.py"
Expand All @@ -7,7 +8,7 @@
- "*.md"

⚙ ci:
- ".github/**"
- .github/**

⚙ build:
- "Makefile"
- Makefile
3 changes: 2 additions & 1 deletion .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: ansible-lint
on:
push:
Expand All @@ -16,6 +17,6 @@ jobs:
- name: Set up Python 3.x (latest)
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: 3.x
- name: Run ansible-lint
uses: ansible/ansible-lint@main
5 changes: 3 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Black
on:
push:
Expand All @@ -15,8 +16,8 @@ jobs:
- name: Set up Python 3.x (latest)
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: 3.x
- name: black
uses: psf/black@stable
with:
version: "22.6.0"
version: 22.6.0
3 changes: 2 additions & 1 deletion .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Flake8
on:
push:
Expand All @@ -15,7 +16,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: "3.9"
- name: Run Flake8
run: |
pip install -r requirements.txt
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/isort.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Isort
on:
push:
Expand All @@ -15,5 +16,5 @@ jobs:
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: 3.x
- uses: isort/isort-action@master
39 changes: 20 additions & 19 deletions .github/workflows/ok-to-test-command.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Integration Test cases
on:
pull_request:
Expand All @@ -10,14 +11,14 @@ jobs:
strategy:
max-parallel: 1
matrix:
python-version: ['3.9']
python-version: ["3.9"]
if: github.event_name == 'repository_dispatch'
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."

- uses: actions/checkout@v2
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'
ref: refs/pull/${{ github.event.client_payload.pull_request.number }}/merge
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -65,23 +66,23 @@ jobs:
- name: Code Coverage Check
if: ${{ always() }}
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
ansible-test coverage html
sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }}
echo "Code coverage: Checking if code coverage is above threshold..."
export COVERAGE_THRESHOLD=70
echo "Threshold: $COVERAGE_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current integration test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
ansible-test coverage html
sshpass -p '${{ secrets.FILER_PASSWORD }}' scp -r tests/output ${{ secrets.FILER_LOCATION }}
echo "Code coverage: Checking if code coverage is above threshold..."
export COVERAGE_THRESHOLD=70
echo "Threshold: $COVERAGE_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current integration test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current integration test coverage is below threshold. Please add more integration tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
- run: echo "🍏 This job's status is ${{ job.status }}."

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ok-to-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Ok-To-Test'
---
name: Ok-To-Test

on: [issue_comment]

jobs:
test:
runs-on: ubuntu-latest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: PR Labeler

on:
- pull_request
- pull_request

jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: ${{ secrets.GITHUB_TOKEN }}
35 changes: 18 additions & 17 deletions .github/workflows/unit_testing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Run compile and tests

on:
Expand All @@ -12,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.9']
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -41,7 +42,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.9']
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -68,18 +69,18 @@ jobs:
ansible-test units --docker default --python ${{ matrix.python-version }} --coverage -v
ansible-test coverage report --include */plugins/* --omit */utils.py,_fetch_url* > coverage.txt
- name: Code Coverage Check
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
echo "Code coverage: Checking if code coverage is above threshold..."
export TESTCOV_THRESHOLD=55
echo "Threshold: $TESTCOV_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
run: |
cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
echo "Code coverage: Checking if code coverage is above threshold..."
export TESTCOV_THRESHOLD=55
echo "Threshold: $TESTCOV_THRESHOLD %"
totalCoverage=`grep TOTAL coverage.txt | awk '{print $6}' | sed 's/%//'`
echo "TOTAL_COVERAGE=${totalCoverage}" >> $GITHUB_ENV
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOV_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "Coverage passed"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Coverage check failed"
exit 1
fi
Loading

0 comments on commit 6df92ef

Please sign in to comment.