|
| 1 | +name: Dart CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + - 'test_consume_*' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - '*' |
| 11 | + |
| 12 | +jobs: |
| 13 | + validate: |
| 14 | + env: |
| 15 | + PUB_CACHE: /home/runner/.pub-cache |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + sdk: [ 2.7.2, stable, dev ] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - uses: dart-lang/[email protected] |
| 24 | + with: |
| 25 | + sdk: ${{ matrix.sdk }} |
| 26 | + |
| 27 | + - name: Print Dart SDK version |
| 28 | + run: dart --version |
| 29 | + |
| 30 | + - uses: actions/cache@v2 |
| 31 | + id: pub-cache # use this to check for `cache-hit` (`steps.pub-cache.outputs.cache-hit != 'true'`) |
| 32 | + with: |
| 33 | + path: ${{ env.PUB_CACHE }} |
| 34 | + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} |
| 35 | + restore-keys: ${{ runner.os }}-pub- |
| 36 | + |
| 37 | + - uses: actions/cache@v2 |
| 38 | + id: dart-tool-cache # use this to check for `cache-hit` (`steps.dart-tool-cache.outputs.cache-hit != 'true'`) |
| 39 | + with: |
| 40 | + path: .dart_tool |
| 41 | + key: ${{ runner.os }}-dart_tool-${{ hashFiles('**/package_config.json') }} |
| 42 | + restore-keys: ${{ runner.os }}-dart_tool- |
| 43 | + |
| 44 | + - id: install |
| 45 | + name: Install dependencies |
| 46 | + run: pub get |
| 47 | + |
| 48 | + - name: Validate dependencies |
| 49 | + run: pub run dependency_validator -i coverage,build_runner,build_test,build_web_compilers,meta,pedantic |
| 50 | + if: always() && steps.install.outcome == 'success' |
| 51 | + |
| 52 | + - name: Analyze project source |
| 53 | + run: if [ ${{ matrix.sdk }} = '2.7.2' ]; then pub global activate tuneup && tuneup check; else pub run dart_dev analyze; fi |
| 54 | + if: always() && steps.install.outcome == 'success' |
| 55 | + |
| 56 | + test_ddc: |
| 57 | + env: |
| 58 | + PUB_CACHE: /home/runner/.pub-cache |
| 59 | + runs-on: ubuntu-latest |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + matrix: |
| 63 | + sdk: [ 2.7.2, stable, dev ] |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + - uses: dart-lang/[email protected] |
| 67 | + with: |
| 68 | + sdk: ${{ matrix.sdk }} |
| 69 | + |
| 70 | + - name: Print Dart SDK version |
| 71 | + run: dart --version |
| 72 | + |
| 73 | + - uses: actions/cache@v2 |
| 74 | + id: pub-cache # use this to check for `cache-hit` (`steps.pub-cache.outputs.cache-hit != 'true'`) |
| 75 | + with: |
| 76 | + path: ${{ env.PUB_CACHE }} |
| 77 | + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} |
| 78 | + restore-keys: ${{ runner.os }}-pub- |
| 79 | + |
| 80 | + - uses: actions/cache@v2 |
| 81 | + id: dart-tool-cache # use this to check for `cache-hit` (`steps.dart-tool-cache.outputs.cache-hit != 'true'`) |
| 82 | + with: |
| 83 | + path: .dart_tool |
| 84 | + key: ${{ runner.os }}-dart_tool-${{ hashFiles('**/package_config.json') }} |
| 85 | + restore-keys: ${{ runner.os }}-dart_tool- |
| 86 | + |
| 87 | + - id: install |
| 88 | + name: Install dependencies |
| 89 | + run: pub get |
| 90 | + |
| 91 | + - name: Run tests (DDC) |
| 92 | + run: pub run dart_dev test -P dartdevc |
| 93 | + if: always() && steps.install.outcome == 'success' |
| 94 | + |
| 95 | + test_dart2js: |
| 96 | + env: |
| 97 | + PUB_CACHE: /home/runner/.pub-cache |
| 98 | + runs-on: ubuntu-latest |
| 99 | + strategy: |
| 100 | + fail-fast: false |
| 101 | + matrix: |
| 102 | + sdk: [ 2.7.2, stable, dev ] |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v2 |
| 105 | + - uses: dart-lang/[email protected] |
| 106 | + with: |
| 107 | + sdk: ${{ matrix.sdk }} |
| 108 | + |
| 109 | + - name: Print Dart SDK version |
| 110 | + run: dart --version |
| 111 | + |
| 112 | + - uses: actions/cache@v2 |
| 113 | + id: pub-cache # use this to check for `cache-hit` (`steps.pub-cache.outputs.cache-hit != 'true'`) |
| 114 | + with: |
| 115 | + path: ${{ env.PUB_CACHE }} |
| 116 | + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} |
| 117 | + restore-keys: ${{ runner.os }}-pub- |
| 118 | + |
| 119 | + - uses: actions/cache@v2 |
| 120 | + id: dart-tool-cache # use this to check for `cache-hit` (`steps.dart-tool-cache.outputs.cache-hit != 'true'`) |
| 121 | + with: |
| 122 | + path: .dart_tool |
| 123 | + key: ${{ runner.os }}-dart_tool-${{ hashFiles('**/package_config.json') }} |
| 124 | + restore-keys: ${{ runner.os }}-dart_tool- |
| 125 | + |
| 126 | + - id: install |
| 127 | + name: Install dependencies |
| 128 | + run: pub get |
| 129 | + |
| 130 | + - name: Run tests (dart2js) |
| 131 | + run: pub run dart_dev test --build-args="-r" -P dart2js |
| 132 | + if: always() && steps.install.outcome == 'success' |
0 commit comments