|
| 1 | +name: Test for Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + lint: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - uses: dart-lang/setup-dart@v1 |
| 13 | + |
| 14 | + - name: Cache dependencies |
| 15 | + uses: actions/cache@v4 |
| 16 | + with: |
| 17 | + path: | |
| 18 | + ~/.pub-cache |
| 19 | + .dart_tool/package_config.json |
| 20 | + key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }} |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: dart pub get |
| 24 | + |
| 25 | + - name: Verify formatting |
| 26 | + run: dart format --output=none --set-exit-if-changed . |
| 27 | + |
| 28 | + - name: Analyze project source |
| 29 | + run: dart analyze --fatal-infos |
| 30 | + |
| 31 | + test: |
| 32 | + needs: lint |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 37 | + sdk: ['stable', '2.19', 'beta'] |
| 38 | + platform: ['vm', 'node'] |
| 39 | + exclude: |
| 40 | + # skip test for beta |
| 41 | + - sdk: 'beta' |
| 42 | + os: macos-latest |
| 43 | + - sdk: 'beta' |
| 44 | + os: windows-latest |
| 45 | + - sdk: 'beta' |
| 46 | + platform: 'node' |
| 47 | + # Skip node platform |
| 48 | + - platform: 'node' |
| 49 | + sdk: '2.19' |
| 50 | + os: macos-latest |
| 51 | + - platform: 'node' |
| 52 | + sdk: '2.19' |
| 53 | + os: windows-latest |
| 54 | + runs-on: ${{ matrix.os }} |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + - uses: dart-lang/setup-dart@v1 |
| 58 | + with: |
| 59 | + sdk: ${{ matrix.sdk }} |
| 60 | + |
| 61 | + - name: Cache dependencies |
| 62 | + uses: actions/cache@v4 |
| 63 | + with: |
| 64 | + path: | |
| 65 | + ~/.pub-cache |
| 66 | + .dart_tool/package_config.json |
| 67 | + key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }} |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: dart pub get |
| 71 | + |
| 72 | + - name: Run tests |
| 73 | + run: dart test -p ${{ matrix.platform }} |
| 74 | + |
| 75 | + integration: |
| 76 | + needs: lint |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 81 | + sdk: ['stable', '2.19', 'beta'] |
| 82 | + exclude: |
| 83 | + # skip test on macOS/Windows for beta |
| 84 | + - sdk: 'beta' |
| 85 | + os: macos-latest |
| 86 | + - sdk: 'beta' |
| 87 | + os: windows-latest |
| 88 | + runs-on: ${{ matrix.os }} |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - uses: dart-lang/setup-dart@v1 |
| 92 | + with: |
| 93 | + sdk: ${{ matrix.sdk }} |
| 94 | + |
| 95 | + - name: Cache dependencies |
| 96 | + uses: actions/cache@v4 |
| 97 | + with: |
| 98 | + path: | |
| 99 | + ~/.pub-cache |
| 100 | + .dart_tool/package_config.json |
| 101 | + key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }} |
| 102 | + |
| 103 | + - name: Run tests |
| 104 | + run: | |
| 105 | + cd test_integration |
| 106 | + dart pub get |
| 107 | + dart run main.dart |
| 108 | +
|
| 109 | + pana: |
| 110 | + if: github.repository == 'bitanon/hashlib_codecs' |
| 111 | + runs-on: ubuntu-latest |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + - uses: dart-lang/setup-dart@v1 |
| 115 | + |
| 116 | + - name: Install pana |
| 117 | + run: dart pub global activate pana |
| 118 | + |
| 119 | + - name: Verify with pana |
| 120 | + run: pana --exit-code-threshold 0 |
0 commit comments