Fix Swift 5.9 compatibility CI runner check #2
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: CI | |
| on: | |
| push: | |
| branches: [main, macos13-intel] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| app: | |
| name: macOS app | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Build release executable | |
| run: swift build -c release | |
| - name: Test sleep-state parsing | |
| run: swift test | |
| - name: Verify native privileged helper | |
| run: | | |
| file .build/release/capsomnia-pmset | grep -q 'Mach-O' | |
| set +e | |
| .build/release/capsomnia-pmset invalid-mode | |
| helper_status=$? | |
| set -e | |
| test "$helper_status" -eq 64 | |
| - name: Build and verify unsigned package payload | |
| run: SKIP_SIGNING=true ./scripts/build-pkg.sh "$RUNNER_TEMP/capsomnia-pkg" | |
| - name: Check shell scripts | |
| run: | | |
| zsh -n scripts/build-app.sh | |
| zsh -n scripts/build-pkg.sh | |
| zsh -n scripts/install.sh | |
| zsh -n scripts/notarize-pkg.sh | |
| zsh -n scripts/uninstall.sh | |
| intel-compatibility: | |
| name: Intel x86_64 compatibility | |
| runs-on: macos-15-intel | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Build and test x86_64 | |
| run: | | |
| test "$(uname -m)" = "x86_64" | |
| sw_vers | |
| swift --version | |
| xcodebuild -version | |
| swift build -c release | |
| swift test | |
| - name: Verify deployment targets | |
| run: | | |
| file .build/release/Capsomnia | grep -q 'x86_64' | |
| file .build/release/capsomnia-pmset | grep -q 'x86_64' | |
| otool -l .build/release/Capsomnia | grep -A3 LC_BUILD_VERSION | grep -q 'minos 13.5' | |
| otool -l .build/release/capsomnia-pmset | grep -A3 LC_BUILD_VERSION | grep -q 'minos 13.5' | |
| ./scripts/build-app.sh | |
| test "$(/usr/libexec/PlistBuddy -c 'Print :LSMinimumSystemVersion' dist/Capsomnia.app/Contents/Info.plist)" = "13.5" | |
| swift-59-compatibility: | |
| name: Swift 5.9 language compatibility | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Build and test with Xcode 15.2 | |
| run: | | |
| sudo xcode-select -s /Applications/Xcode_15.2.app | |
| swift --version | tee "$RUNNER_TEMP/swift-version" | |
| grep -Eq 'Swift version 5\.9(\.| )' "$RUNNER_TEMP/swift-version" | |
| xcodebuild -version | tee "$RUNNER_TEMP/xcode-version" | |
| grep -q 'Xcode 15.2' "$RUNNER_TEMP/xcode-version" | |
| swift build -c release | |
| swift test | |
| site: | |
| name: GitHub Pages site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run build:site | |
| - run: npm test | |
| - name: Check generated site CSS | |
| run: git diff --exit-code -- docs/styles.css | |
| - name: Validate SEO files | |
| run: | | |
| test -f docs/robots.txt | |
| test -f docs/sitemap.xml | |
| test -f docs/googlee5de8ad27617297a.html | |
| test -f docs/ja/index.html | |
| test -f docs/zh-hans/index.html | |
| test -f docs/ko/index.html | |
| test "$(cat docs/CNAME)" = 'capsomnia.com' | |
| grep -q 'https://capsomnia.com/' docs/sitemap.xml | |
| grep -q 'https://capsomnia.com/ja/' docs/sitemap.xml | |
| grep -q 'https://capsomnia.com/zh-hans/' docs/sitemap.xml | |
| grep -q 'https://capsomnia.com/ko/' docs/sitemap.xml | |
| grep -q 'Sitemap: https://capsomnia.com/sitemap.xml' docs/robots.txt | |
| grep -q 'google-site-verification: googlee5de8ad27617297a.html' docs/googlee5de8ad27617297a.html | |
| grep -q '"@type": "SoftwareApplication"' docs/index.html | |
| grep -q '"inLanguage": "en"' docs/index.html | |
| grep -q '"inLanguage": "ja"' docs/ja/index.html | |
| grep -q '"inLanguage": "zh-Hans"' docs/zh-hans/index.html | |
| grep -q '"inLanguage": "ko"' docs/ko/index.html | |
| grep -q 'hreflang="x-default"' docs/index.html |