mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-01-31 00:00:03 +08:00
167 lines
5.4 KiB
YAML
167 lines
5.4 KiB
YAML
name: Cordova HTTP Plugin CI
|
|
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
inputs:
|
|
ci_reason:
|
|
description: "Optional note for manual runs"
|
|
required: false
|
|
|
|
env:
|
|
node_version: "22.x"
|
|
java_distribution: "zulu"
|
|
java_version: "17"
|
|
gradle_version: "7.6.1"
|
|
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
|
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- name: Install node modules
|
|
run: npm ci
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
test-www-interface:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
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
|
|
outputs:
|
|
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- id: should-run-tests
|
|
# need to find a solution for signing iOS App so we can build for device target instead simulator
|
|
# for now we skip iOS tests on BrowserStack
|
|
run: echo "run_tests=false" >> "$GITHUB_OUTPUT"
|
|
- name: Install node modules
|
|
run: npm ci
|
|
- name: Update test cert for httpbin.org
|
|
run: npm run update:cert
|
|
- name: Build test app
|
|
run: scripts/build-test-app.sh --ios --emulator
|
|
- name: Upload artifact to BrowserStack
|
|
if: steps.should-run-tests.outputs.run_tests == 'true'
|
|
run: scripts/upload-browserstack.sh --ios
|
|
|
|
test-ios:
|
|
needs: build-ios
|
|
if: needs.build-ios.outputs.run-tests == 'true'
|
|
runs-on: macOS-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- name: Install node modules
|
|
run: npm ci
|
|
- name: Run e2e tests (iOS)
|
|
run: scripts/test-app.sh --ios --device
|
|
|
|
build-android:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
run-tests: ${{ steps.should-run-tests.outputs.run_tests }}
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- id: should-run-tests
|
|
run: |
|
|
if [ -n "${BROWSERSTACK_USERNAME}" ]; then
|
|
echo "run_tests=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "run_tests=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Install node modules
|
|
run: npm ci
|
|
- name: Install JDK
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: ${{ env.java_distribution }}
|
|
java-version: ${{ env.java_version }}
|
|
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
|
|
run: |
|
|
set -euo pipefail
|
|
curl -sSL "https://services.gradle.org/distributions/gradle-${{ env.gradle_version }}-bin.zip" -o gradle.zip
|
|
unzip -q gradle.zip -d "$HOME/gradle"
|
|
echo "$HOME/gradle/gradle-${{ env.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: steps.should-run-tests.outputs.run_tests == 'true'
|
|
run: scripts/upload-browserstack.sh --android
|
|
|
|
test-android:
|
|
needs: build-android
|
|
if: needs.build-android.outputs.run-tests == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
- name: Install node modules
|
|
run: npm ci
|
|
- name: Run e2e tests (Android)
|
|
run: scripts/test-app.sh --android --device
|