Files
cordova-plugin-advanced-http/.github/workflows/ci.yml
2025-12-02 06:45:43 +01:00

109 lines
3.7 KiB
YAML

name: Cordova HTTP Plugin CI
on:
push:
workflow_dispatch:
inputs:
ci_reason:
description: "Optional note for manual runs"
required: false
env:
nodejs: "16.x"
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
jobs:
test-www-interface:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.nodejs }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install node modules
run: npm ci
- name: Run WWW interface tests
run: npm run test:js
build-ios:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.nodejs }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install node modules
run: npm ci
- name: Update test cert for httpbin.org
run: npm run update:cert
# need to find a solution for signing iOS App so we can build for device target instead simulator
- name: Build test app
run: scripts/build-test-app.sh --ios --emulator
- name: Upload artifact to BrowserStack
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/upload-browserstack.sh --ios
# need to have an App for device target
# - name: Run e2e tests
# if: env.BROWSERSTACK_USERNAME != ''
# run: scripts/test-app.sh --ios --device
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Node.js ${{ env.nodejs }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.nodejs }}
cache: npm
cache-dependency-path: package-lock.json
- name: Install node modules
run: npm ci
- name: Install JDK
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "17"
java-package: jdk
- name: Ensure Android build-tools 33.0.2
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" "build-tools;33.0.2"
- name: Install Gradle 7.6.1
run: |
set -euo pipefail
GRADLE_VERSION=7.6.1
curl -sSL "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" -o gradle.zip
unzip -q gradle.zip -d "$HOME/gradle"
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
rm gradle.zip
- name: Update test cert for httpbin.org
run: npm run update:cert
- name: Shim missing DX binaries (https://stackoverflow.com/a/68430992)
run: |
set -euo pipefail
BUILD_TOOLS_PATH="$(ls -d $ANDROID_HOME/build-tools/*/ | sort -V | tail -n 1)"
D8_BIN="${BUILD_TOOLS_PATH}d8"
DX_BIN="${BUILD_TOOLS_PATH}dx"
D8_JAR="${BUILD_TOOLS_PATH}lib/d8.jar"
DX_JAR="${BUILD_TOOLS_PATH}lib/dx.jar"
if [ -f "$D8_BIN" ] && [ ! -e "$DX_BIN" ]; then
ln -s "$D8_BIN" "$DX_BIN"
fi
if [ -f "$D8_JAR" ] && [ ! -e "$DX_JAR" ]; then
ln -s "$D8_JAR" "$DX_JAR"
fi
- name: Build test app
run: scripts/build-test-app.sh --android --device
- name: Upload artifact to BrowserStack
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/upload-browserstack.sh --android
- name: Run e2e tests
if: env.BROWSERSTACK_USERNAME != ''
run: scripts/test-app.sh --android --device