|
1 | 1 | name: CI
|
2 | | -on: |
| 2 | +on: |
| 3 | + workflow_dispatch: |
3 | 4 | push:
|
4 | 5 | branches:
|
5 | | - - main |
6 | | - |
| 6 | + - "main" |
| 7 | + paths: |
| 8 | + - "lib/**.dart" |
| 9 | + - "test/**.dart" |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - "main" |
| 13 | + paths: |
| 14 | + - "lib/**.dart" |
| 15 | + - "test/**.dart" |
| 16 | + |
7 | 17 | jobs:
|
8 | | - dart-test: |
9 | | - name: Run Dart test and analyze |
| 18 | + checkout: |
| 19 | + name: "Checkout" |
10 | 20 | runs-on: ubuntu-latest
|
| 21 | + defaults: |
| 22 | + run: |
| 23 | + working-directory: ./ |
| 24 | + container: |
| 25 | + image: dart:stable |
| 26 | + timeout-minutes: 10 |
11 | 27 | steps:
|
12 | | - - name: Checkout code |
13 | | - uses: actions/checkout@v2 |
| 28 | + - name: π Get latest code |
| 29 | + uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: π Cache pub modules |
| 32 | + uses: actions/cache@v2 |
| 33 | + env: |
| 34 | + cache-name: cache-leetcode-pub |
| 35 | + with: |
| 36 | + path: | |
| 37 | + $PWD/.pub_cache/ |
| 38 | + key: ${{ runner.os }}-leetcode |
| 39 | + |
| 40 | + - name: ποΈ Export pub cache directory |
| 41 | + run: export PUB_CACHE=$PWD/.pub_cache/ |
| 42 | + |
| 43 | + - name: π· Install Dependencies |
| 44 | + timeout-minutes: 1 |
| 45 | + run: dart pub get |
14 | 46 |
|
15 | | - - name: Set up Dart |
16 | | - uses: dart-lang/setup-dart@v1 |
| 47 | + - name: π Check format |
| 48 | + timeout-minutes: 1 |
| 49 | + run: dart format --set-exit-if-changed -l 120 -o none . |
17 | 50 |
|
18 | | - - name: Install dependencies |
19 | | - run: dart pub get |
| 51 | + - name: π Check analyzer |
| 52 | + timeout-minutes: 1 |
| 53 | + run: dart analyze --fatal-infos --fatal-warnings lib |
20 | 54 |
|
21 | | - - name: Analyze project source |
22 | | - run: dart analyze |
| 55 | + - name: π§ͺ Run tests |
| 56 | + timeout-minutes: 2 |
| 57 | + run: | |
| 58 | + dart run coverage:test_with_coverage -fb -o coverage -- \ |
| 59 | + --concurrency=6 --platform vm --coverage=./coverage --reporter=expanded test/leetcode_test.dart |
23 | 60 |
|
24 | | - - name: Run tests |
25 | | - run: dart test |
| 61 | + - name: π₯ Upload coverage to Codecov |
| 62 | + timeout-minutes: 1 |
| 63 | + uses: codecov/codecov-action@v2.1.0 |
| 64 | + # with: |
| 65 | + # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos |
0 commit comments