Skip to content

Commit

Permalink
Dev: move build phase to Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
andriydruk committed Jun 10, 2024
1 parent 4a0d756 commit 57d9cdd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build-android-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:

build-swift-android-arm-64:
runs-on: ubuntu-20.04
container: ubuntu:focal

steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: ./build/Linux/000-install-dependencies.sh
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: Clone scripts
uses: actions/checkout@v1
- name: Install NDK
run: ./build/Linux/002-install-ndk.sh
- name: Define build folders
Expand All @@ -32,15 +32,18 @@ jobs:
with:
path: ~/out/swift-android-arm64-v8a.tar
key: ${{ runner.os }}-arm64-${{ hashFiles('.swift.sum') }}
- name: Build Swift
if: steps.cache-swift-arm-64.outputs.cache-hit != 'true'
run: ./build/Linux/031-build-swift-arm64.sh
- name: Clean sources
if: steps.cache-swift-arm-64.outputs.cache-hit != 'true'
run: rm -rf ~/swift-source
- name: Archive toolchain
- name: Build Swift (Docker)
if: steps.cache-swift-arm-64.outputs.cache-hit != 'true'
run: cd ~/out; tar -cvf swift-android-arm64-v8a.tar swift-android
run: |
docker run --rm \
-v $HOME:/root \
ubuntu:focal \
/bin/bash -c "\
cd /root/work/swift-android-toolchain/swift-android-toolchain && \
./build/Linux/000-install-dependencies.sh && \
./build/Linux/031-build-swift-arm64.sh && \
cd ~/out && tar -cvf swift-android-arm64-v8a.tar swift-android \
"
- uses: actions/upload-artifact@v2
with:
name: swift-android-arm64-v8a
Expand Down
1 change: 1 addition & 0 deletions build/Linux/000-install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ clang --version
# Install swift for bootstraping
wget https://download.swift.org/swift-5.10-release/ubuntu2004/swift-5.10-RELEASE/swift-5.10-RELEASE-ubuntu20.04.tar.gz
tar -xvzf swift-5.10-RELEASE-ubuntu20.04.tar.gz
rm swift-5.10-RELEASE-ubuntu20.04.tar.gz
export PATH=$HOME/swift-5.10-RELEASE-ubuntu20.04/usr/bin:$PATH
echo "export PATH=\$HOME/swift-5.10-RELEASE-ubuntu20.04/usr/bin:\$PATH" >> .build_env

Expand Down
15 changes: 6 additions & 9 deletions build/Linux/003-define-build-folders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@

cd $HOME

swift_source=swift-source
swift_install=out/swift-android
swift_source=~/swift-source
swift_install=~/out/swift-android

mkdir -p $swift_source
mkdir -p $swift_install

swift_source=`realpath $swift_source`
swift_install=`realpath $swift_install`

echo "export DST_ROOT=$swift_install" >> .build_env
echo "export SWIFT_SRC=$swift_source" >> .build_env

echo "export ICU_LIBS=\$HOME/icu" >> .build_env
echo "export OPENSSL_LIBS=\$HOME/openssl" >> .build_env
echo "export CURL_LIBS=\$HOME/curl" >> .build_env
echo "export LIBXML_LIBS=\$HOME/libxml" >> .build_env
echo "export ICU_LIBS=~/icu" >> .build_env
echo "export OPENSSL_LIBS=~/openssl" >> .build_env
echo "export CURL_LIBS=~/curl" >> .build_env
echo "export LIBXML_LIBS=~/libxml" >> .build_env

echo "export DISPATCH_SRC=\$SWIFT_SRC/swift-corelibs-libdispatch" >> .build_env
echo "export FOUNDATION_SRC=\$SWIFT_SRC/swift-corelibs-foundation" >> .build_env
Expand Down

0 comments on commit 57d9cdd

Please sign in to comment.