# This workflow is provided for testing changes to the action. # When developing make sure that "Scan 2 - failing" produces expected kube-linter validation logs. name: kube-linter-action development self-test on: push: branches: [ main ] pull_request: branches: [ main ] jobs: test-scan: strategy: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] format: [ plain, json, sarif ] version: [ latest, 0.2.3 ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 - name: Scan 1 - should succeed uses: ./ with: directory: sample/valid-yaml config: sample/.kube-linter-config.yaml format: ${{ matrix.format }} version: ${{ matrix.version }} - name: Scan 2 - should fail id: failing-scan uses: ./ with: directory: sample/invalid-yaml config: sample/.kube-linter-config.yaml format: ${{ matrix.format }} version: ${{ matrix.version }} continue-on-error: true - name: Verify Scan 2 should have failed shell: bash run: | echo "Verifying that kube-linter-action outcome (${{ steps.failing-scan.outcome }}) from Scan 2 is failure." [[ "${{ steps.failing-scan.outcome }}" == "failure" ]] test-with-sarif-upload: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 # Setup directory where github/codeql-action/upload-sarif@v4 looks up files by default. - name: Create ../results directory for sarif files shell: bash run: mkdir -p ../results - name: Scan - should succeed uses: ./ with: directory: sample/valid-yaml config: sample/.kube-linter-config.yaml format: sarif output-file: ../results/kube-linter-success.sarif - name: Upload SARIF output file to GitHub uses: github/codeql-action/upload-sarif@v4 test-with-sarif-upload-fail: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 # Setup directory where github/codeql-action/upload-sarif@v4 looks up files by default. - name: Create ../results directory for sarif files shell: bash run: mkdir -p ../results - name: Scan - should fail uses: ./ with: directory: sample/invalid-yaml config: sample/.kube-linter-config.yaml format: sarif output-file: ../results/kube-linter-fail.sarif continue-on-error: true - name: Upload SARIF output file to GitHub uses: github/codeql-action/upload-sarif@v4 test-fail-on-invalid-resource: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Scan 1 - should succeed uses: ./ with: directory: sample/non-kubernetes-yaml config: sample/.kube-linter-config.yaml - name: Scan 2 - should fail id: failing-scan uses: ./ with: directory: sample/non-kubernetes-yaml config: sample/.kube-linter-config.yaml fail-on-invalid-resource: "true" continue-on-error: true - name: Verify Scan 2 should have failed shell: bash run: | echo "Verifying that kube-linter-action outcome (${{ steps.failing-scan.outcome }}) from Scan 2 is failure." [[ "${{ steps.failing-scan.outcome }}" == "failure" ]]