swift-foundation-icu-demo #27
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: swift-foundation-icu-demo | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| InternationalizationBenchmarks: | |
| #runs-on: ubuntu-24.04 | |
| runs-on: macos-15 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: "Install Dependencies: jemalloc" | |
| run: brew install jemalloc | |
| - name: "Checkout swift-foundation-icu-demo" | |
| uses: actions/checkout@v4 | |
| with: | |
| path: swift-foundation-icu-demo | |
| - name: "Checkout swift-foundation" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: swiftlang/swift-foundation | |
| path: swift-foundation | |
| - name: "Checkout swift-corelibs-foundation" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: swiftlang/swift-corelibs-foundation | |
| path: swift-corelibs-foundation | |
| - name: "Checkout swift-collections" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: apple/swift-collections | |
| path: swift-collections | |
| - name: "Checkout swift-syntax" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: apple/swift-syntax | |
| path: swift-syntax | |
| - name: "Checkout swift-foundation-icu" | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: swiftlang/swift-foundation-icu | |
| path: swift-foundation-icu | |
| - name: "Patch swift-foundation benchmarks" | |
| working-directory: swift-foundation | |
| # these assertions fail in the CI for some reason | |
| run: | | |
| ls | |
| find . -name BenchmarkCalendar.swift | |
| perl -pi -e 's;assert\(identifier ;//assert\(identifier ;g' Benchmarks/Internationalization/BenchmarkCalendar.swift | |
| perl -pi -e 's;assert\(cal.firstWeekday;//assert\(cal.firstWeekday;g' Benchmarks/Internationalization/BenchmarkCalendar.swift | |
| cat Benchmarks/Internationalization/BenchmarkCalendar.swift | |
| - name: "Build Foundation" | |
| working-directory: swift-foundation | |
| run: SWIFTCI_USE_LOCAL_DEPS=/Users/runner/work/swift-foundation-icu-demo/swift-foundation-icu-demo swift build | |
| - name: "Test swift-foundation-icu-demo" | |
| working-directory: swift-foundation-icu-demo | |
| run: LC_ALL=en_US_POSIX swift test | |
| - name: "Run InternationalizationBenchmarks with Packaged ICU Data" | |
| working-directory: swift-foundation/Benchmarks | |
| run: SWIFTCI_USE_LOCAL_DEPS=/Users/runner/work/swift-foundation-icu-demo/swift-foundation-icu-demo LC_ALL=en_US_POSIX swift run InternationalizationBenchmarks | |
| - name: "Apply swift-foundation-icu PR #53" | |
| working-directory: swift-foundation-icu | |
| run: gh pr checkout 53 | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: "Patch swift-foundation-icu to use ICU data file" | |
| working-directory: swift-foundation-icu | |
| run: perl -pi -e 's/"USE_PACKAGE_DATA"/"DISABLED_USE_PACKAGE_DATA"/g' Package.swift && cat Package.swift | |
| - name: "Test swift-foundation-icu-demo with ICU data file" | |
| working-directory: swift-foundation-icu-demo | |
| run: ICU_DATA_DIR_PREFIX=${{ github.workspace }}/swift-foundation-icu-demo/LOCALE_DATA LC_ALL=en_US_POSIX swift test | |
| - name: "Verify that ICU data file is being used" | |
| working-directory: swift-foundation-icu-demo | |
| run: | | |
| mv LOCALE_DATA/usr/share/icu/icudt74l.dat LOCALE_DATA/usr/share/icu/icudt74l.dat.disabled | |
| echo '' > LOCALE_DATA/usr/share/icu/icudt74l.dat | |
| # should fail after we clobber the data file | |
| ICU_DATA_DIR_PREFIX=${{ github.workspace }}/swift-foundation-icu-demo/LOCALE_DATA LC_ALL=en_US_POSIX swift test || echo "FAILED AS EXPECTED" > /tmp/testsfailed.txt | |
| cat /tmp/testsfailed.txt | |
| # move the data file back | |
| mv LOCALE_DATA/usr/share/icu/icudt74l.dat.disabled LOCALE_DATA/usr/share/icu/icudt74l.dat | |
| - name: "Run InternationalizationBenchmarks with External ICU Data" | |
| working-directory: swift-foundation/Benchmarks | |
| run: SWIFTCI_USE_LOCAL_DEPS=/Users/runner/work/swift-foundation-icu-demo/swift-foundation-icu-demo LC_ALL=en_US_POSIX swift run InternationalizationBenchmarks | |