[API] feat: implement AnyValue attribute hierarchy and strict compliance (#95) #371
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dart CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| analyze: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: 'stable' | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Verify formatting | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: Analyze project source | |
| run: dart analyze --fatal-infos | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| sdk: ['stable', 'beta'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ matrix.sdk }} | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Run tests | |
| run: dart test | |
| coverage: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # push the coverage badge to the badges branch | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: 'stable' | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Activate coverage | |
| run: dart pub global activate coverage | |
| - name: Run tests with coverage | |
| run: dart pub global run coverage:test_with_coverage | |
| - name: Build coverage badge | |
| run: python3 tool/make_coverage_badge.py coverage/lcov.info coverage-badge.svg | |
| - name: Coverage must not drop | |
| run: | | |
| NEW=$(awk -F: '/^LF:/{lf+=$2} /^LH:/{lh+=$2} END{if (lf>0) printf "%.4f", 100*lh/lf}' coverage/lcov.info) | |
| git fetch --depth 1 origin badges | |
| OLD=$(git show origin/badges:coverage.txt 2>/dev/null | awk 'NR==1{print $1}') | |
| if [ -z "$OLD" ]; then | |
| OLD=$(git show origin/badges:coverage.svg 2>/dev/null | grep -o '[0-9][0-9.]*%' | head -1 | tr -d '%') | |
| fi | |
| echo "coverage: new=${NEW}% baseline=${OLD:-none}%" | |
| if [ -n "$OLD" ] && [ "$(echo "$NEW < $OLD" | bc -l)" = "1" ]; then | |
| echo "::error::Coverage dropped: ${NEW}% < ${OLD}% (published baseline). Coverage goes up, not down." | |
| exit 1 | |
| fi | |
| - name: Publish coverage badge | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| git clone --depth 1 --branch badges "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git" /tmp/badges | |
| cp coverage-badge.svg /tmp/badges/coverage.svg | |
| awk -F: '/^LF:/{lf+=$2} /^LH:/{lh+=$2} END{if (lf>0) printf "%.4f %d %d\n", 100*lh/lf, lh, lf}' coverage/lcov.info > /tmp/badges/coverage.txt | |
| cd /tmp/badges | |
| if ! git diff --quiet; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -am "Update coverage badge" | |
| git push | |
| fi | |
| pana: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: 'stable' | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Install pana | |
| run: dart pub global activate pana | |
| - name: Run pana | |
| run: dart pub global run pana --no-warning --source path . | |
| web-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: 'stable' | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Run web tests (dart2js + dart2wasm) | |
| run: dart test -p chrome -c dart2js,dart2wasm |