1
Fork 0
photoview/.github/workflows/codeql-analysis.yml

98 lines
2.8 KiB
YAML
Raw Normal View History

2020-09-27 21:58:32 +02:00
name: "Code Analysis"
2020-09-27 21:28:27 +02:00
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
2024-08-29 15:25:25 +02:00
- cron: '37 1 * * 4'
2020-09-27 21:28:27 +02:00
jobs:
2024-08-29 15:25:25 +02:00
create-matrix:
runs-on: ubuntu-latest
steps:
- name: Get languages from repo
id: set-matrix
uses: advanced-security/set-codeql-language-matrix@v1
with:
access-token: ${{ github.token }}
endpoint: ${{ github.event.repository.languages_url }}
outputs:
matrix: ${{ steps.set-matrix.outputs.languages }}
2020-09-27 21:28:27 +02:00
analyze:
name: Analyze
2024-08-29 15:25:25 +02:00
needs: create-matrix
if: ${{ needs.create-matrix.outputs.matrix != '[]' && github.repository == 'photoview/photoview' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
2020-09-27 21:28:27 +02:00
steps:
- name: Checkout repository
2024-08-29 15:25:25 +02:00
uses: actions/checkout@v4
2020-09-27 21:28:27 +02:00
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
2024-08-29 15:25:25 +02:00
uses: github/codeql-action/init@v3
with:
2024-08-29 15:25:25 +02:00
languages: ${{ matrix.language }}
# Run further tests
queries: security-extended, security-and-quality
2020-09-27 21:28:27 +02:00
2024-08-29 15:25:25 +02:00
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
2024-08-29 15:25:25 +02:00
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
anchore:
name: Anchore scan code dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate report
id: scan
uses: anchore/scan-action@v4
with:
path: "."
fail-build: false
add-cpes-if-none: true
- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: ${{ steps.scan.conclusion == 'success' || steps.scan.conclusion == 'failure' }}
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
hadolint:
name: Hadolint Dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
id: hadolint-report
with:
dockerfile: Dockerfile
config: ${{ github.workspace }}/.hadolint.yaml
output-file: hadolint.sarif
format: sarif
failure-threshold: ignore
- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: ${{ steps.hadolint-report.conclusion == 'success' || steps.hadolint-report.conclusion == 'failure' }}
with:
sarif_file: hadolint.sarif