Skip to content

Release 1.9.4

Release 1.9.4 #3120

Workflow file for this run

name: skipstone CI
on:
push:
branches: [main]
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
pull_request:
jobs:
build-plugin:
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
swift:
- '6.3.2'
os:
- 'ubuntu-latest'
#- 'macos-latest'
# Homebrew bottle builds on macos-14, so we need to as well
- 'macos-14'
steps:
- name: Checkout skipstone.git
uses: actions/checkout@v7
with:
# skip.git submodule needed for SkipDriveExternal
submodules: true
- uses: Homebrew/actions/setup-homebrew@main
# we only use Swiftly on Linux to install the specific Swift
# because it needs to exactly match the Swift SDK for Android version
#
# on macOS we *cannot* use the OSS toolchain because we need to
# compile using the Xcode toolchain (which handles building
# the universal binary)
- name: "Install Swift Host Toolchain and Static Linux SDK"
if: runner.os == 'Linux'
run: |
sudo apt-get -y install libcurl4-openssl-dev || (sudo apt-get update && sudo apt-get -y install libcurl4-openssl-dev)
brew install swiftly
swiftly init --skip-install --assume-yes --quiet-shell-followup
swiftly install --assume-yes --use ${{ matrix.swift }}
swiftly run swift --version
# https://download.swift.org/swift-6.3-release/static-sdk/swift-6.3-RELEASE/swift-6.3-RELEASE_static-linux-0.1.0.artifactbundle.tar.gz
curl -fsSL --retry 5 -o 'swift-static-linux-sdk.tar.gz' 'https://download.swift.org/swift-${{ matrix.swift }}-release/static-sdk/swift-${{ matrix.swift }}-RELEASE/swift-${{ matrix.swift }}-RELEASE_static-linux-0.1.0.artifactbundle.tar.gz'
swiftly run swift sdk install 'swift-static-linux-sdk.tar.gz'
# default to using the Swiftly version of swift
echo "$HOME/.local/share/swiftly/bin" >> $GITHUB_PATH
- run: swift --version
- run: swift build
- run: swift test --parallel
- name: "Build ${{ runner.os }} plugin"
shell: bash
run: |
# "macos" or "linux"
OSNAME=$(echo $RUNNER_OS | tr '[A-Z]' '[a-z]')
if [[ "${OSNAME}" == "linux" ]]; then
# only build x86 for Linux to improve build time
./scripts/build_${OSNAME}_plugin.sh --arch x86_64
else
./scripts/build_${OSNAME}_plugin.sh
fi
BUILD_DIR="${PWD}/.build/artifactbundle-${OSNAME}"
SKIP_BIN="${BUILD_DIR}/skip.artifactbundle/bin"
# set the PATH to include the newly-built `skip` command
echo "${SKIP_BIN}" >> $GITHUB_PATH
# override skip plugin to use the locally built binary
echo "SKIP_COMMAND_OVERRIDE=${SKIP_BIN}/skip" >> $GITHUB_ENV
mkdir artifacts/
find "${BUILD_DIR}"
cp -av "${BUILD_DIR}"/*.zip artifacts/
- run: skip welcome
- name: "Upload Build Artifacts"
uses: actions/upload-artifact@v7
with:
name: skip-plugin-${{ runner.os }}
path: artifacts/
android-ci:
needs: build-plugin
timeout-minutes: 240
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-24.04'
- 'macos-15-intel'
swift:
- '6.3'
android-api:
- '28'
#- '34'
android-arch:
- 'x86_64'
android-sdk:
# blank will use the latest official release (e.g., 6.3)
- ''
#- '6.3'
#- 'nightly-6.3'
- 'nightly-main'
android-ndk:
# blank will use the default
- ''
#- 'r27d'
#- 'r28c'
#- 'r29'
steps:
- uses: Homebrew/actions/setup-homebrew@main
# The transpiled (Lite) and Fuse framework `swift test` runs execute the Kotlin suite under
# Robolectric, and recent Android SDK levels (e.g. SDK 36) require Java 21. The runners default to
# Java 17, so without this the Robolectric run fails with:
# "Failed to create a Robolectric sandbox: Android SDK 36 requires Java 21 (have Java 17)".
- name: "Set up Java 21 (required by Robolectric for recent Android SDKs)"
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: "Install Host Toolchain prerequisites"
if: runner.os == 'Linux'
run: |
sudo apt-get -y install libcurl4-openssl-dev || (sudo apt-get update && sudo apt-get -y install libcurl4-openssl-dev)
- run: brew install swiftly
- run: swiftly init --skip-install --assume-yes --quiet-shell-followup
- run: swiftly install --assume-yes --use ${{ matrix.swift }}
- run: swiftly run swift --version
- run: swift --version
- name: "Download skip plugin"
uses: actions/download-artifact@v8
with:
name: skip-plugin-${{ runner.os }}
path: skip-artifact
- name: "Install skip from artifact"
shell: bash
run: |
OSNAME=$(echo $RUNNER_OS | tr '[A-Z]' '[a-z]')
cd skip-artifact
unzip skip-${OSNAME}.zip
SKIP_BIN="${PWD}/skip.artifactbundle/bin"
find skip.artifactbundle -type f -name skip -exec chmod +x {} +
echo "${SKIP_BIN}" >> $GITHUB_PATH
echo "SKIP_COMMAND_OVERRIDE=${SKIP_BIN}/skip" >> $GITHUB_ENV
- run: which skip
- run: skip version
- run: skip doctor
- name: "Create and export new app"
if: runner.os != 'Linux'
working-directory: ${{ runner.temp }}
run: |
skip init --transpiled-app --free --appid some.app.id some-app SomeApp SomeAppModel
# verify that the project itself is free
skip verify --free --project some-app
# perform an export of the app
skip export --appindex --validate-export --show-tree --project some-app
- name: "Install Swift SDK for Android"
run: |
sdk_arg=""
if [[ "${{ matrix.android-sdk }}" != "" ]]; then
sdk_arg="--version ${{ matrix.android-sdk }}"
fi
ndk_arg=""
if [[ "${{ matrix.android-ndk }}" != "" ]]; then
ndk_arg="--ndk-version ${{ matrix.android-ndk }}"
fi
skip android sdk install ${sdk_arg} ${ndk_arg}
- run: skip android build --version
#- run: skip doctor
#- name: "Create and export new Skip Fuse app project"
# if: runner.os != 'Linux'
# #if: false
# working-directory: ${{ runner.temp }}
# run: |
# skip init --no-build --native-app --appid=some.app.id demo-skip-appfuse DemoSkipApp
# cd demo-skip-appfuse
# skip export --debug --ios-sim
- run: skip checkup --native
if: runner.os != 'Linux'
# needs to not be in a directory named "skipstone"
# https://github.com/skiptools/skipstone/issues/216
working-directory: ${{ runner.temp }}
- name: "Prepare Android emulator environment"
if: runner.os == 'Linux'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# need to free disk space or the emulator fails to launch sometimes
sudo rm -rf /Applications/Xcode_1[45]*.app /Applications/Xcode_16.[0123].app /opt/microsoft /opt/google /opt/az /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/local/julia* /opt/hostedtoolcache/CodeQL /usr/local/share/boost
- name: "Create and Launch Emulator"
run: |
export ANDROID_USER_HOME=$HOME/.android
export ANDROID_EMULATOR_HOME=$ANDROID_USER_HOME
export ANDROID_AVD_HOME=$ANDROID_EMULATOR_HOME/avd
skip android emulator create --verbose
skip android emulator list --verbose
# watch the logs for errors
(sleep 20; ${ANDROID_HOME}/platform-tools/adb logcat) &
skip android emulator launch --background --android-connect-timeout=300 --verbose
echo "Waiting for device"
${ANDROID_HOME}/platform-tools/adb wait-for-device
sleep 30
date
echo "echoing PING"
${ANDROID_HOME}/platform-tools/adb shell echo PING
echo "running shell getprop sys.boot_completed"
${ANDROID_HOME}/platform-tools/adb shell getprop sys.boot_completed
date
- name: "Test new Swift package on emulator"
working-directory: ${{ runner.temp }}
run: |
mkdir package-demo
cd package-demo
swift package init --name "PackageDemo"
# test on host OS
swift test
# test using shared object file loaded from .apk
skip android test --verbose --apk --arch ${{ matrix.android-arch }} --android-connect-timeout 60
# test using xcrunner binary
skip android test --verbose --arch ${{ matrix.android-arch }}
# now add a failing test to make sure it actually fails
echo '@Test func shouldFail() { #expect(1+1 == 3, "Test should fail") }' >> Tests/PackageDemoTests/PackageDemoTests.swift
swift build --build-tests
! swift test
! skip android test --apk --arch ${{ matrix.android-arch }}
- name: "Test new Skip Lite framework on emulator"
working-directory: ${{ runner.temp }}
run: |
skip init --no-build --transpiled-model --module-tests demo-lite-framework DemoFramework
cd demo-lite-framework
# Robolectric test
swift test
# Emulator test
ANDROID_SERIAL=emulator-5554 swift test
- name: "Test new Skip Fuse framework on emulator"
# compile errors on Linux with skip-android-bridge
if: runner.os != 'Linux'
working-directory: ${{ runner.temp }}
run: |
skip init --no-build --native-model --bridged --module-tests demo-fuse-framework DemoFramework
cd demo-fuse-framework
# Robolectric test
swift test
# Emulator test
ANDROID_SERIAL=emulator-5554 swift test
# now add a failing test to make sure it actually fails
echo '#if os(Android)' >> Tests/DemoFrameworkTests/DemoFrameworkTests.swift
echo '@Test func shouldFailOnAndroid() { #expect(1+1 == 3, "Test should fail on Android") }' >> Tests/DemoFrameworkTests/DemoFrameworkTests.swift
echo '#endif' >> Tests/DemoFrameworkTests/DemoFrameworkTests.swift
swift build --build-tests
# Robolectric should still pass
swift test
# Emulator test should fail
! ANDROID_SERIAL=emulator-5554 swift test