pdf_signature/.github/workflows/pr-unit-tests.yml

72 lines
2.0 KiB
YAML

name: Run unit tests on Pull Request
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: "pr-unit-tests"
cancel-in-progress: false
jobs:
unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout repository
uses: actions/checkout@v7
continue-on-error: true
id: checkout_https
with:
repository: ${{ github.repository }}
ref: refs/pull/${{ github.event.pull_request.number }}/merge
fetch-depth: 1
persist-credentials: false
- name: Checkout repository via SSH (fallback)
if: steps.checkout_https.outcome == 'failure'
uses: actions/checkout@v7
with:
repository: ${{ github.repository }}
ref: refs/pull/${{ github.event.pull_request.number }}/merge
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-strict: false
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Run build_runner (if needed)
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Run static analysis (for logs)
run: flutter analyze || true
- name: Setup reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Annotate analyzer results with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# run analyzer and pipe into reviewdog so PRs get inline annotations
flutter analyze 2>&1 | reviewdog -efm="%f:%l:%c: %m" -name="flutter analyze" -reporter=github-pr-check -filter-mode=added -level=warning || true
# - name: Run tests
# run: flutter test