Skip to content

Build Android image #55

Build Android image

Build Android image #55

Workflow file for this run

name: Build Docker images
on: [pull_request]
env:
ghprbPullId: ${{ github.event.number }}
ghprbGhRepository: ${{ github.repository_owner }}/${{ github.event.repository.name }}
jobs:
build:
name: Build Docker images
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker images
run: ./ci_test.py
- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: docker-logs
path: |
*.log
static-linux-build:
name: Build Static Linux image
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker images
working-directory: swift-ci/sdks/static-linux
run: ./build
android-build:
name: Build Android ${{ matrix.arch }} SDK
strategy:
fail-fast: false
matrix:
arch: ['x86_64', '']
#name: Build Android SDK
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Android SDK
working-directory: swift-ci/sdks/android
run: |
sudo apt install -q ninja-build patchelf
# build all architectures
#./build
# just build x86_64 for testing
#TARGET_ARCHS=x86_64 ./build
# build arch specified by the matrix
TARGET_ARCHS=${{ matrix.arch }} ./build
- name: Get artifact info
id: paths
run: |
echo "swift-root=$(dirname ${{ runner.temp }}/swift-android-sdk/host-toolchain/*/usr)" >> $GITHUB_OUTPUT
echo "swift-path=$(ls ${{ runner.temp }}/swift-android-sdk/host-toolchain/*/usr/bin/swift)" >> $GITHUB_OUTPUT
ARTIFACT_PATH=$(realpath ${{ runner.temp }}/swift-android-sdk/products/*.artifactbundle.tar.gz)
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
# artifacts need a unique name so we suffix with the matrix arch(s)
ARTIFACT_SUFFIX=""
if [[ ! -z "${{ matrix.arch }}" ]]; then
ARTIFACT_SUFFIX="-${{ matrix.arch }}"
fi
echo "artifact-name=$(basename ${ARTIFACT_PATH} .tar.gz)${ARTIFACT_SUFFIX}.tar.gz" >> $GITHUB_OUTPUT
- name: Upload SDK artifactbundle
uses: actions/upload-artifact@v4
with:
compression-level: 0
name: ${{ steps.paths.outputs.artifact-name }}
path: ${{ steps.paths.outputs.artifact-path }}
- name: Cleanup
run: |
# need to free up some space or else when installing we get: No space left on device
rm -rf ${{ runner.temp }}/swift-android-sdk/{build,src}
- name: Install SDK
run: |
${{ steps.paths.outputs.swift-path }} sdk install ${{ steps.paths.outputs.artifact-path }}
${{ steps.paths.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.paths.outputs.swift-path }} sdk list | head -n 1) x86_64-unknown-linux-android
- name: Build swift-algorithms
run: |
cd ${{ runner.temp }}
git clone https://github.com/apple/swift-algorithms.git
cd swift-algorithms
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android28
- name: Test swift-algorithms on Android
uses: skiptools/swift-android-action@main
with:
#package-path: ${{ runner.temp }}/DemoProject
package-path: ${{ runner.temp }}/swift-algorithms
installed-sdk: x86_64-unknown-linux-android28
installed-swift: ${{ steps.paths.outputs.swift-root }}
- name: Build Demo Project
if: false
run: |
cd ${{ runner.temp }}
mkdir DemoProject
cd DemoProject
${{ steps.paths.outputs.swift-path }} --version
${{ steps.paths.outputs.swift-path }} package init
echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
${{ steps.paths.outputs.swift-path }} build --build-tests --swift-sdk x86_64-unknown-linux-android28