| name: package:intl4x |
| permissions: |
| pull-requests: read # Changed to read, as we are only reading labels |
| contents: read # Added for checkout action |
| pages: write # For the dart doc page job |
| id-token: write |
| |
| on: |
| pull_request: |
| branches: [main] |
| types: [opened, synchronize, reopened, labeled, unlabeled] |
| paths: |
| - ".github/workflows/intl4x.yml" |
| - "pkgs/intl4x/**" |
| push: |
| branches: [main] |
| paths: |
| - ".github/workflows/intl4x.yml" |
| - "pkgs/intl4x/**" |
| schedule: |
| - cron: "0 0 * * 0" # weekly |
| |
| jobs: |
| build: |
| runs-on: ${{ matrix.os }} |
| |
| defaults: |
| run: |
| working-directory: pkgs/intl4x |
| strategy: |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| steps: |
| - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 |
| |
| - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c |
| with: |
| sdk: main |
| |
| - run: dart pub get --example |
| |
| - run: dart analyze --fatal-infos |
| |
| - run: dart format --output=none --set-exit-if-changed . |
| |
| - run: dart test |
| |
| - run: dart test -p chrome |
| |
| - run: dart --enable-experiment=record-use build cli --target example.dart |
| working-directory: pkgs/intl4x/example |
| |
| - run: tree . -a |
| if: matrix.os == 'ubuntu-latest' |
| |
| - name: Run example (Linux) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'ubuntu-latest' |
| run: ./build/cli/linux_x64/bundle/bin/example |
| |
| - name: Print file size and check limit for example (Linux) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'ubuntu-latest' |
| run: | |
| FILE_PATH="build/cli/linux_x64/bundle/lib/libicu4x.so" |
| FILE_SIZE=$(stat -c %s "$FILE_PATH") |
| echo "Linux executable size: $FILE_SIZE bytes" |
| if [ "$FILE_SIZE" -gt 10485760 ]; then |
| echo "Error: Linux executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)." |
| exit 1 |
| fi |
| |
| - name: Run example (Mac) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'macos-latest' |
| run: ./build/cli/macos_arm64/bundle/bin/example |
| |
| - name: Print file size and check limit for example (Mac) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'macos-latest' |
| run: | |
| FILE_PATH="build/cli/macos_arm64/bundle/lib/libicu4x.dylib" |
| FILE_SIZE=$(stat -f %z "$FILE_PATH") |
| echo "macOS executable size: $FILE_SIZE bytes" |
| if [ "$FILE_SIZE" -gt 10485760 ]; then |
| echo "Error: macOS executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)." |
| exit 1 |
| fi |
| |
| - name: Run example (Windows) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'windows-latest' |
| run: .\build\cli\windows_x64\bundle\bin\example.exe |
| - name: Print file size and check limit for example (Windows) |
| working-directory: pkgs/intl4x/example |
| if: matrix.os == 'windows-latest' |
| run: | |
| $filePath = ".\build\cli\windows_x64\bundle\lib\icu4x.dll" |
| $fileSize = (Get-Item $filePath).Length |
| Write-Host "Windows executable size: $fileSize bytes" |
| if ($fileSize -gt 10485760) { |
| Write-Host "Error: Windows executable size ($fileSize bytes) exceeds 10MB limit (10485760 bytes)." |
| exit 1 |
| } |
| |
| docs: |
| if: ${{ github.event_name == 'push' }} |
| runs-on: ubuntu-latest |
| |
| defaults: |
| run: |
| working-directory: pkgs/intl4x |
| steps: |
| - name: Checkout Repository |
| uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 |
| |
| - name: Setup Dart SDK |
| uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c |
| with: |
| sdk: main |
| |
| - name: Install dependencies |
| run: dart pub get |
| |
| - name: Generate Documentation |
| run: dart doc |
| |
| - name: Upload Documentation Artifact |
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b |
| with: |
| path: pkgs/intl4x/doc/api/ |
| |
| deploy: |
| if: ${{ github.event_name == 'push' }} |
| environment: |
| name: github-pages |
| url: ${{ steps.deployment.outputs.page_url }} |
| runs-on: ubuntu-latest |
| needs: docs |
| |
| steps: |
| - name: Deploy to GitHub Pages |
| id: deployment |
| uses: actions/deploy-pages@854d7aa1b99e4509c4d1b53d69b7ba4eaf39215a |