mirror of
https://github.com/immich-app/immich.git
synced 2026-05-17 13:02:14 -04:00
115 lines
3.6 KiB
YAML
115 lines
3.6 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.check.outputs.should_run }}
|
|
steps:
|
|
- id: token
|
|
uses: immich-app/devtools/actions/create-workflow-token@caa599d954228439ea3e8ce1c3328f41ab120ee6 # create-workflow-token-action-v2.0.0
|
|
with:
|
|
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
|
|
|
|
- name: Check what should run
|
|
id: check
|
|
uses: immich-app/devtools/actions/pre-job@91f342bb4477c4bc10c576ae739da875d85aa164 # pre-job-action-v2.0.4
|
|
with:
|
|
github-token: ${{ steps.token.outputs.token }}
|
|
filters: |
|
|
mobile:
|
|
- 'mobile/**'
|
|
force-filters: |
|
|
- '.github/workflows/static_analysis.yml'
|
|
force-events: 'workflow_dispatch,release'
|
|
|
|
mobile-dart-analyze:
|
|
name: Run Dart Code Analysis
|
|
needs: pre-job
|
|
if: ${{ fromJSON(needs.pre-job.outputs.should_run).mobile == true }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: ./mobile
|
|
steps:
|
|
- id: token
|
|
uses: immich-app/devtools/actions/create-workflow-token@caa599d954228439ea3e8ce1c3328f41ab120ee6 # create-workflow-token-action-v2.0.0
|
|
with:
|
|
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: Setup Mise
|
|
uses: immich-app/devtools/actions/use-mise@cf6e190bacde3d7bda59372a786b36ac7d01536a # use-mise-action-v2.0.1
|
|
with:
|
|
github_token: ${{ steps.token.outputs.token }}
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Install dependencies for UI package
|
|
run: flutter pub get
|
|
working-directory: ./mobile/packages/ui
|
|
|
|
- name: Install dependencies for UI Showcase
|
|
run: flutter pub get
|
|
working-directory: ./mobile/packages/ui/showcase
|
|
|
|
- name: Generate translation files
|
|
run: mise //mobile:codegen:translation
|
|
|
|
- name: Run Build Runner
|
|
run: mise //mobile:codegen:dart
|
|
|
|
- name: Generate platform API
|
|
run: mise //mobile:codegen:pigeon
|
|
|
|
- name: Find file changes
|
|
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4
|
|
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 'mise //mobile:codegen:dart' and 'mise //mobile:codegen:pigeon'"
|
|
echo "Changed files: ${CHANGED_FILES}"
|
|
exit 1
|
|
|
|
- name: Run analyze
|
|
run: mise //mobile:analyze
|
|
|
|
- name: Run format
|
|
run: mise //mobile:format
|
|
|
|
# TODO: Re-enable after upgrading custom_lint
|
|
# - name: Run dart custom_lint
|
|
# run: dart run custom_lint
|