diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 551c9861bd9..d7a63848b3b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -186,55 +186,6 @@ jobs: . venv/bin/activate pre-commit install-hooks - lint-bandit: - name: Check bandit - runs-on: ubuntu-latest - needs: - - changes - - prepare-base - steps: - - name: Check out code from GitHub - uses: actions/checkout@v2.4.0 - - name: Set up Python ${{ env.DEFAULT_PYTHON }} - uses: actions/setup-python@v2.3.0 - id: python - with: - python-version: ${{ env.DEFAULT_PYTHON }} - - name: Restore base Python virtual environment - id: cache-venv - uses: actions/cache@v2.1.7 - with: - path: venv - key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ - needs.prepare-base.outputs.python-key }} - - name: Fail job if Python cache restore failed - if: steps.cache-venv.outputs.cache-hit != 'true' - run: | - echo "Failed to restore Python virtual environment from cache" - exit 1 - - name: Restore pre-commit environment from cache - id: cache-precommit - uses: actions/cache@v2.1.7 - with: - path: ${{ env.PRE_COMMIT_CACHE }} - key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} - - name: Fail job if pre-commit cache restore failed - if: steps.cache-precommit.outputs.cache-hit != 'true' - run: | - echo "Failed to restore pre-commit environment from cache" - exit 1 - - name: Run bandit (fully) - if: needs.changes.outputs.test_full_suite == 'true' - run: | - . venv/bin/activate - pre-commit run --hook-stage manual bandit --all-files --show-diff-on-failure - - name: Run bandit (partially) - if: needs.changes.outputs.test_full_suite == 'false' - shell: bash - run: | - . venv/bin/activate - pre-commit run --hook-stage manual bandit --files {homeassistant,tests}/components/${{ needs.changes.outputs.integrations_glob }}/* --show-diff-on-failure - lint-black: name: Check black runs-on: ubuntu-latest @@ -379,7 +330,9 @@ jobs: lint-other: name: Check other linters runs-on: ubuntu-latest - needs: prepare-base + needs: + - changes + - prepare-base steps: - name: Check out code from GitHub uses: actions/checkout@v2.4.0 @@ -452,7 +405,6 @@ jobs: - name: Register hadolint problem matcher run: | echo "::add-matcher::.github/workflows/matchers/hadolint.json" - - name: Check Dockerfile uses: docker://hadolint/hadolint:v1.18.2 with: @@ -462,6 +414,18 @@ jobs: with: args: hadolint Dockerfile.dev + - name: Run bandit (fully) + if: needs.changes.outputs.test_full_suite == 'true' + run: | + . venv/bin/activate + pre-commit run --hook-stage manual bandit --all-files --show-diff-on-failure + - name: Run bandit (partially) + if: needs.changes.outputs.test_full_suite == 'false' + shell: bash + run: | + . venv/bin/activate + pre-commit run --hook-stage manual bandit --files {homeassistant,tests}/components/${{ needs.changes.outputs.integrations_glob }}/* --show-diff-on-failure + hassfest: name: Check hassfest runs-on: ubuntu-latest @@ -651,7 +615,6 @@ jobs: - changes - gen-requirements-all - hassfest - - lint-bandit - lint-black - lint-other - lint-isort