-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (56 loc) · 2.07 KB
/
news-check-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Run Checks - News
on:
pull_request:
paths:
- 'flutter/news/**'
jobs:
test:
runs-on: ubuntu-latest
name: Run Test and Static Analysis
steps:
- uses: actions/checkout@v3
- id: 'auth'
uses: google-github-actions/auth@v0
with:
credentials_json: '${{ secrets.gcp_credentials }}'
- id: 'secrets'
uses: google-github-actions/get-secretmanager-secrets@v0
with:
secrets: |-
news-api-key:projects/859887479109/secrets/NEWS_API_KEY/versions/1
- name: Creates local file with API key
working-directory: ./flutter/news
run: echo "NEWS_API_KEY=${{ steps.secrets.outputs.news-api-key }}" > .secrets_env
- id: 'flutter'
uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.3'
- name: Retrieve Dependencies
working-directory: ./flutter/news
run: flutter pub get
- name: Build Runner
working-directory: ./flutter/news
run: flutter pub run build_runner build
- name: Run the static analysis
working-directory: ./flutter/news
run: flutter analyze
- name: Run the tests
working-directory: ./flutter/news
run: flutter test --coverage --machine > test-results.json
- name: Remove unrequired files from coverage
working-directory: ./flutter/news
run: flutter pub global activate remove_from_coverage && flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v1
with:
coverage-files: ./flutter/news/coverage/lcov.info
minimum-coverage: 75
artifact-name: news-code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./flutter/news
- name: Upload Test Reports
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results
path: ./flutter/news/test-results.json