mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
125 lines
3.7 KiB
YAML
125 lines
3.7 KiB
YAML
name: Static Code Analysis
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
pre-job:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
should_run: ${{ steps.found_paths.outputs.mobile == 'true' || steps.should_force.outputs.should_force == 'true' }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
persist-credentials: false
|
|
- id: found_paths
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
|
|
with:
|
|
filters: |
|
|
mobile:
|
|
- 'mobile/**'
|
|
workflow:
|
|
- '.github/workflows/static_analysis.yml'
|
|
- name: Check if we should force jobs to run
|
|
id: should_force
|
|
run: echo "should_force=${{ steps.found_paths.outputs.workflow == 'true' || github.event_name == 'release' }}" >> "$GITHUB_OUTPUT"
|
|
|
|
mobile-dart-analyze:
|
|
name: Run Dart Code Analysis
|
|
needs: pre-job
|
|
if: ${{ needs.pre-job.outputs.should_run == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # v2
|
|
with:
|
|
channel: 'stable'
|
|
flutter-version-file: ./mobile/pubspec.yaml
|
|
|
|
- name: Install dependencies
|
|
run: dart pub get
|
|
working-directory: ./mobile
|
|
|
|
- name: Generate translation file
|
|
run: make translation; dart format lib/generated/codegen_loader.g.dart
|
|
working-directory: ./mobile
|
|
|
|
- name: Run Build Runner
|
|
run: make build
|
|
working-directory: ./mobile
|
|
|
|
- name: Find file changes
|
|
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20
|
|
id: verify-changed-files
|
|
with:
|
|
files: |
|
|
mobile/**/*.g.dart
|
|
mobile/**/*.gr.dart
|
|
mobile/**/*.drift.dart
|
|
|
|
- name: Verify files have not changed
|
|
if: steps.verify-changed-files.outputs.files_changed == 'true'
|
|
env:
|
|
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
|
|
run: |
|
|
echo "ERROR: Generated files not up to date! Run make_build inside the mobile directory"
|
|
echo "Changed files: ${CHANGED_FILES}"
|
|
exit 1
|
|
|
|
- name: Run dart analyze
|
|
run: dart analyze --fatal-infos
|
|
working-directory: ./mobile
|
|
|
|
- name: Run dart format
|
|
run: dart format lib/ --set-exit-if-changed
|
|
working-directory: ./mobile
|
|
|
|
- name: Run dart custom_lint
|
|
run: dart run custom_lint
|
|
working-directory: ./mobile
|
|
|
|
zizmor:
|
|
name: zizmor
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
security-events: write
|
|
contents: read
|
|
actions: read
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
|
|
- name: Run zizmor 🌈
|
|
run: uvx zizmor --format=sarif . > results.sarif
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload SARIF file
|
|
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3
|
|
with:
|
|
sarif_file: results.sarif
|
|
category: zizmor
|