| # A CI workflow to run the Dart Code Metrics analyzer (https://dcm.dev). | |
| # NOTE: DCM usage in DevTools is currently experimental! | |
| # The DCM_CI_KEY and DCM_EMAIL secrets are set in the admin settings page | |
| # of the flutter/devtools repo. They can be found at: go/dash-devexp-dcm-keys | |
| # These are associated with a trial license of DCM, and will need to be changed | |
| # if we decide to purchase an actual license. The trial license will expire on | |
| # April 11, 2024. | |
| # If you want to install and run DCM locally, please refer to CONTRIBUTING.md | |
| # for instructions. | |
| name: Dart Code Metrics | |
| on: | |
| pull_request_target: | |
| # labeled and unlabeled are required along with open to re-run | |
| # workflow when the run-dcm-workflow label is added or removed. | |
| types: [opened, labeled, unlabeled] | |
| branches: | |
| - master | |
| paths: | |
| - "**/*.dart" | |
| - "!packages/devtools_app/lib/devtools.dart" | |
| jobs: | |
| flutter-prep: | |
| uses: ./.github/workflows/flutter-prep.yaml | |
| with: | |
| os-name: ubuntu | |
| requires-label: "run-dcm-workflow" | |
| needs-checkout-merge: true | |
| dcm: | |
| if: contains(github.event.pull_request.labels.*.name, 'run-dcm-workflow') | |
| name: Dart Code Metrics | |
| needs: flutter-prep | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone Flutter DevTools | |
| uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | |
| with: | |
| ref: "${{ github.event.pull_request.head.sha }}" | |
| - name: Load Cached Flutter SDK | |
| uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | |
| with: | |
| path: | | |
| ./flutter-sdk | |
| key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }} | |
| - name: Run tool/bots.sh | |
| run: ./tool/bots.sh | |
| - name: Install DCM | |
| run: | | |
| sudo apt-get update | |
| wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg | |
| echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list | |
| sudo apt-get update | |
| sudo apt-get install dcm | |
| sudo chmod +x /usr/bin/dcm | |
| - name: Setup Dart SDK | |
| uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d | |
| - name: Run DCM on root | |
| run: | | |
| dcm analyze --ci-key="${{ secrets.DCM_CI_KEY }}" --email="${{ secrets.DCM_EMAIL }}" packages/devtools_app packages/devtools_shared packages/devtools_test |