Test Swift SDK #468
This file contains 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: Test Swift SDK | |
on: | |
workflow_dispatch: | |
inputs: | |
caller_run_id: | |
type: string | |
required: true | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
test: | |
name: Integration Tests | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Install Swift | |
uses: swift-actions/setup-swift@v2 | |
with: | |
swift-version: "5.9" | |
- name: Checkout Sources | |
uses: actions/checkout@v4 | |
- name: Install Flipt | |
uses: flipt-io/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }} | |
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }} | |
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }} | |
- name: Download Artifact (iOS arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ steps.generate_token.outputs.token }} | |
name: flipt-engine-ffi-iOS-arm64.tar.gz | |
path: /tmp | |
run-id: ${{ inputs.caller_run_id }} | |
- name: Download Artifact (iOS sim) | |
uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ steps.generate_token.outputs.token }} | |
name: flipt-engine-ffi-iOS-sim.tar.gz | |
path: /tmp | |
run-id: ${{ inputs.caller_run_id }} | |
- name: Download Artifact (Darwin arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ steps.generate_token.outputs.token }} | |
name: flipt-engine-ffi-Darwin-arm64.tar.gz | |
path: /tmp | |
run-id: ${{ inputs.caller_run_id }} | |
- name: Extract Artifacts | |
run: | | |
mkdir -p /tmp/flipt-engine-ffi-iOS-arm64 | |
mkdir -p /tmp/flipt-engine-ffi-iOS-arm64-sim | |
mkdir -p /tmp/flipt-engine-ffi-Darwin-arm64 | |
tar -xzvf /tmp/flipt-engine-ffi-iOS-arm64.tar.gz -C /tmp/flipt-engine-ffi-iOS-arm64 | |
tar -xzvf /tmp/flipt-engine-ffi-iOS-arm64-sim.tar.gz -C /tmp/flipt-engine-ffi-iOS-arm64-sim | |
tar -xzvf /tmp/flipt-engine-ffi-Darwin-arm64.tar.gz -C /tmp/flipt-engine-ffi-Darwin-arm64 | |
- name: XCode Build | |
run: | | |
xcodebuild -create-xcframework \ | |
-library /tmp/flipt-engine-ffi-iOS-arm64/target/aarch64-apple-ios/release/libfliptengine.a -headers ../flipt-engine-ffi/include/ \ | |
-library /tmp/flipt-engine-ffi-iOS-arm64-sim/target/aarch64-apple-ios-sim/release/libfliptengine.a -headers ../flipt-engine-ffi/include/ \ | |
-library /tmp/flipt-engine-ffi-Darwin-arm64/target/aarch64-apple-darwin/release/libfliptengine.a -headers ../flipt-engine-ffi/include/ \ | |
-output ../flipt-client-swift/Sources/FliptEngineFFI.xcframework | |
- name: Run Flipt | |
env: | |
FLIPT_STORAGE_TYPE: "local" | |
FLIPT_STORAGE_LOCAL_PATH: "./test/fixtures/testdata" | |
FLIPT_AUTHENTICATION_REQUIRED: true | |
FLIPT_AUTHENTICATION_METHODS_TOKEN_ENABLED: true | |
FLIPT_AUTHENTICATION_METHODS_TOKEN_BOOTSTRAP_TOKEN: "secret" | |
run: flipt& | |
- name: Wait for Flipt to be ready | |
run: | | |
while ! curl -s http://0.0.0.0:8080/health | grep -q "SERVING"; do | |
sleep 1 | |
done | |
- name: Run Integration Tests | |
env: | |
FLIPT_URL: "http://0.0.0.0:8080" | |
FLIPT_AUTH_TOKEN: "secret" | |
run: | | |
cd ./flipt-client-swift | |
swift test |