Repository navigation
Add lifecycle event callbacks for Android and iOS #29
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
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| actions: write | |
| jobs: | |
| nix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Local cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /nix/store | |
| key: "${{ runner.os }}-nix-cache" | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| extra_nix_config: | | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - uses: cachix/cachix-action@v15 | |
| with: | |
| name: jappie | |
| authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
| - run: nix-build | |
| - run: nix-shell --run "echo OK" | |
| - name: Cancel workflow on failure | |
| if: failure() | |
| continue-on-error: true | |
| run: gh run cancel ${{ github.run_id }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Local cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /nix/store | |
| key: "${{ runner.os }}-nix-android-cache" | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| extra_nix_config: | | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - uses: cachix/cachix-action@v15 | |
| with: | |
| name: jappie | |
| authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
| - run: nix-build nix/android.nix | |
| - run: nix-build nix/apk.nix -o result-apk | |
| if: github.ref == 'refs/heads/master' | |
| - name: Upload Android APK | |
| if: github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haskell-mobile-android | |
| path: result-apk/haskell-mobile.apk | |
| - name: Cancel workflow on failure | |
| if: failure() | |
| continue-on-error: true | |
| run: gh run cancel ${{ github.run_id }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| ios: | |
| runs-on: macos-latest | |
| env: | |
| HAS_SIGNING: ${{ secrets.APPLE_CERTIFICATE_BASE64 != '' && 'true' || 'false' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Local cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /nix/store | |
| key: "${{ runner.os }}-nix-ios-cache" | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| extra_nix_config: | | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| - uses: cachix/cachix-action@v15 | |
| with: | |
| name: jappie | |
| authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
| - run: nix-build nix/ios.nix | |
| - name: Upload iOS library | |
| if: github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haskell-mobile-ios | |
| path: | | |
| result/lib/libHaskellMobile.a | |
| result/include/HaskellMobile.h | |
| # --- IPA build (requires Apple signing secrets) --- | |
| - name: Stage Haskell library for Xcode | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| run: | | |
| mkdir -p ios/lib ios/include | |
| cp result/lib/libHaskellMobile.a ios/lib/ | |
| cp result/include/HaskellMobile.h ios/include/ | |
| - name: Generate Xcode project | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| run: nix-shell -p xcodegen --run "cd ios && xcodegen generate" | |
| - name: Import signing certificate | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| env: | |
| APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} | |
| APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
| run: | | |
| CERT_PATH=$RUNNER_TEMP/certificate.p12 | |
| KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
| KEYCHAIN_PASSWORD=$(openssl rand -hex 20) | |
| echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > "$CERT_PATH" | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security import "$CERT_PATH" -P "$APPLE_CERTIFICATE_PASSWORD" \ | |
| -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" | |
| security set-key-partition-list -S apple-tool:,apple: \ | |
| -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security list-keychain -d user -s "$KEYCHAIN_PATH" | |
| - name: Install provisioning profile | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| env: | |
| APPLE_PROVISIONING_PROFILE_BASE64: ${{ secrets.APPLE_PROVISIONING_PROFILE_BASE64 }} | |
| run: | | |
| PROFILE_PATH=$RUNNER_TEMP/profile.mobileprovision | |
| echo "$APPLE_PROVISIONING_PROFILE_BASE64" | base64 --decode > "$PROFILE_PATH" | |
| mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
| cp "$PROFILE_PATH" ~/Library/MobileDevice/Provisioning\ Profiles/ | |
| - name: Build archive | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| env: | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| run: | | |
| xcodebuild archive \ | |
| -project ios/HaskellMobile.xcodeproj \ | |
| -scheme HaskellMobile \ | |
| -sdk iphoneos \ | |
| -archivePath $RUNNER_TEMP/HaskellMobile.xcarchive \ | |
| CODE_SIGN_STYLE=Manual \ | |
| DEVELOPMENT_TEAM="$APPLE_TEAM_ID" \ | |
| CODE_SIGN_IDENTITY="Apple Distribution" \ | |
| -allowProvisioningUpdates | |
| - name: Export IPA | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| env: | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| run: | | |
| cat > $RUNNER_TEMP/ExportOptions.plist << PLIST | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>method</key> | |
| <string>app-store-connect</string> | |
| <key>teamID</key> | |
| <string>${APPLE_TEAM_ID}</string> | |
| <key>destination</key> | |
| <string>export</string> | |
| <key>signingStyle</key> | |
| <string>manual</string> | |
| </dict> | |
| </plist> | |
| PLIST | |
| xcodebuild -exportArchive \ | |
| -archivePath $RUNNER_TEMP/HaskellMobile.xcarchive \ | |
| -exportOptionsPlist $RUNNER_TEMP/ExportOptions.plist \ | |
| -exportPath $RUNNER_TEMP/ipa-output | |
| - name: Upload IPA | |
| if: env.HAS_SIGNING == 'true' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haskell-mobile-ios-ipa | |
| path: ${{ runner.temp }}/ipa-output/*.ipa | |
| - name: Cleanup keychain | |
| if: always() && env.HAS_SIGNING == 'true' | |
| run: security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true | |
| - name: Cancel workflow on failure | |
| if: failure() | |
| continue-on-error: true | |
| run: gh run cancel ${{ github.run_id }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| cabal: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| ghc: | |
| - '9.12' | |
| - '9.10' | |
| - '9.8' | |
| - '9.6' | |
| os: [ubuntu-latest, macOS-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| - name: Cabal cache | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-cabal | |
| with: | |
| path: ~/.cabal | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| - name: Cabal update | |
| run: cabal update | |
| - name: Build using cabal | |
| run: cabal build all | |
| - name: Test | |
| run: cabal test all | |
| - name: Cancel workflow on failure | |
| if: failure() | |
| continue-on-error: true | |
| run: gh run cancel ${{ github.run_id }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} |