diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ed2fd28 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,66 @@ +name: Tests + +on: + pull_request: + branches: [main] + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + + - name: Clone sibling packages + run: | + git clone https://github.com/torlando-tech/reticulum-swift.git ../reticulum-swift + git clone https://github.com/torlando-tech/LXMF-swift.git ../LXMF-swift + git clone https://github.com/torlando-tech/LXST-swift.git ../LXST-swift + + - name: Select Xcode + run: | + XCODE=$(ls -d /Applications/Xcode_16*.app 2>/dev/null | sort -V | tail -1) + echo "Using $XCODE" + sudo xcode-select -s "$XCODE" + xcodebuild -version + + - name: Find simulator + id: sim + run: | + DEVICE_ID=$(xcrun simctl list devices available -j \ + | python3 -c "import sys,json; devs=json.load(sys.stdin)['devices']; print(next(d['udid'] for rt in devs for d in devs[rt] if 'iPhone' in d['name']))") + echo "device_id=$DEVICE_ID" >> "$GITHUB_OUTPUT" + echo "Using simulator: $DEVICE_ID" + + - name: Build + run: | + xcodebuild build \ + -project ColumbaApp.xcodeproj \ + -scheme ColumbaApp \ + -sdk iphonesimulator \ + -destination "id=${{ steps.sim.outputs.device_id }}" \ + CODE_SIGN_IDENTITY=- \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=YES \ + DEVELOPMENT_TEAM="" \ + PROVISIONING_PROFILE_SPECIFIER="" + + - name: Build and run tests + run: | + xcodebuild test \ + -project ColumbaApp.xcodeproj \ + -scheme ColumbaApp \ + -sdk iphonesimulator \ + -destination "id=${{ steps.sim.outputs.device_id }}" \ + -only-testing:ColumbaAppTests \ + -resultBundlePath TestResults.xcresult \ + CODE_SIGN_IDENTITY=- \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=YES \ + DEVELOPMENT_TEAM="" \ + PROVISIONING_PROFILE_SPECIFIER=""