Skip to content

Commit 99d444f

Browse files
authored
Merge pull request #1 from MillerTechnologyPeru/feature/github-ci
Fixed Foundation library path
2 parents caf84e2 + 27ee6c2 commit 99d444f

File tree

13 files changed

+320
-90
lines changed

13 files changed

+320
-90
lines changed

.devcontainer/Dockerfile

Lines changed: 16 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -25,90 +25,24 @@ COPY library-scripts/node-debian.sh /tmp/library-scripts/
2525
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
2626
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
2727

28-
# Install dependencies
29-
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && apt-get -q update && \
30-
apt-get -q install -y \
31-
ninja-build \
32-
qemu-user-static \
33-
wget \
34-
bash \
35-
bc \
36-
binutils \
37-
build-essential \
38-
bzip2 \
39-
cpio \
40-
g++ \
41-
gcc \
42-
git \
43-
gzip \
44-
libncurses5-dev \
45-
make \
46-
mercurial \
47-
whois \
48-
patch \
49-
perl \
50-
python3 \
51-
rsync \
52-
sed \
53-
tar \
54-
unzip \
55-
file \
56-
bison \
57-
flex \
58-
cmake \
59-
neofetch \
60-
&& rm -r /var/lib/apt/lists/*
61-
62-
# Download Swift toolchain
63-
RUN set -e; \
64-
ARCH_NAME="$(dpkg --print-architecture)"; \
65-
url=; \
66-
case "${ARCH_NAME##*-}" in \
67-
'amd64') \
68-
OS_ARCH_SUFFIX=''; \
69-
;; \
70-
'arm64') \
71-
OS_ARCH_SUFFIX='-aarch64'; \
72-
;; \
73-
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
74-
esac; \
75-
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
76-
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
77-
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
78-
# - Grab curl here so we cache better up above
79-
&& export DEBIAN_FRONTEND=noninteractive \
80-
&& apt-get -q update && apt-get -q install -y curl && rm -rf /var/lib/apt/lists/* \
81-
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
82-
&& export GNUPGHOME="$(mktemp -d)" \
83-
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
84-
&& gpg --batch --quiet --keyserver keyserver.ubuntu.com --recv-keys "$SWIFT_SIGNING_KEY" \
85-
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
86-
# - Unpack the toolchain, set libs permissions, and clean up.
87-
&& mkdir -p /workspaces/swift \
88-
&& tar -xzf swift.tar.gz --directory /workspaces/swift --strip-components=1 \
89-
&& chmod -R o+r /usr/lib/swift \
90-
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
91-
28+
# Define paths
9229
ENV SWIFT_NATIVE_TOOLS=/workspaces/swift/usr/bin
93-
94-
# Download LLVM headers
95-
RUN set -e; \
96-
mkdir -p /workspaces/llvm \
97-
&& cd /workspaces/llvm \
98-
&& wget https://github.com/colemancda/swift-armv7/releases/download/0.4.0/llvm-swift.zip \
99-
&& unzip llvm-swift.zip \
100-
&& rm -rf llvm-swift.zip
101-
10230
ENV SWIFT_LLVM_DIR=/workspaces/llvm
103-
104-
# Download Buildroot
31+
ENV BUILDROOT_DIR=/workspaces/buildroot
10532
ENV BUILDROOT_RELEASE=2022.08.1
10633

107-
RUN set -e; \
108-
cd /workspaces \
109-
&& wget "https://buildroot.org/downloads/buildroot-$BUILDROOT_RELEASE.tar.gz" \
110-
&& tar -xf "buildroot-$BUILDROOT_RELEASE.tar.gz" \
111-
&& mv "buildroot-$BUILDROOT_RELEASE" buildroot \
112-
&& rm -rf "buildroot-$BUILDROOT_RELEASE.tar.gz"
34+
# Install Dependencies
35+
COPY library-scripts/install-dependencies.sh /tmp/library-scripts/
36+
RUN apt-get update && \
37+
/bin/bash /tmp/library-scripts/install-dependencies.sh \
38+
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
11339

114-
ENV BUILDROOT_DIR=/workspaces/buildroot
40+
# Install Swift compiler
41+
COPY library-scripts/install-swift.sh /tmp/library-scripts/
42+
RUN /bin/bash /tmp/library-scripts/install-swift.sh \
43+
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
44+
45+
# Download Buildroot
46+
COPY build-scripts/download-buildroot.sh /tmp/build-scripts/
47+
RUN /bin/bash /tmp/build-scripts/download-buildroot.sh \
48+
&& rm -rf /var/lib/apt/lists/* /tmp/build-scripts

.devcontainer/build-scripts/build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22
set -e
33

44
# Configurable
55
SRC_ROOT="${SRC_ROOT:=$(pwd)}"
66
DEFCONFIG="${DEFCONFIG:=imx6slevk_swift_defconfig}"
7+
BUILDROOT_DIR="${BUILDROOT_DIR:=/workspaces/buildroot}"
8+
SWIFT_NATIVE_TOOLS="${SWIFT_NATIVE_TOOLS:=/workspaces/swift/usr/bin}"
9+
SWIFT_LLVM_DIR="${SWIFT_LLVM_DIR:=/workspaces/llvm}"
710

811
# Modify defconfig
912
DEFCONFIG_FILE=$SRC_ROOT/configs/$DEFCONFIG
1013
DEFCONFIG_FILE_COPY=$SRC_ROOT/configs/tmp_$DEFCONFIG
1114
cp -rf $DEFCONFIG_FILE $DEFCONFIG_FILE_COPY
12-
echo "BR2_PACKAGE_SWIFT_NATIVE_TOOLS=$SWIFT_NATIVE_TOOLS" >> $DEFCONFIG_FILE_COPY
13-
echo "BR2_PACKAGE_SWIFT_NATIVE_TOOLS=$SWIFT_NATIVE_TOOLS" >> $DEFCONFIG_FILE_COPY
15+
echo "BR2_PACKAGE_SWIFT_HELLO=y" >> $DEFCONFIG_FILE_COPY
16+
echo "BR2_PACKAGE_SWIFT_NATIVE_TOOLS=\"${SWIFT_NATIVE_TOOLS}\"" >> $DEFCONFIG_FILE_COPY
17+
echo "BR2_PACKAGE_SWIFT_LLVM_DIR=\"${SWIFT_LLVM_DIR}\"" >> $DEFCONFIG_FILE_COPY
1418

1519
# Build
1620
cd $BUILDROOT_DIR
17-
make BR2_EXTERNAL=$SRC_ROOT $DEFCONFIG
21+
make BR2_EXTERNAL=$SRC_ROOT tmp_$DEFCONFIG
1822
rm -rf $DEFCONFIG_FILE_COPY
1923
make
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
BUILDROOT_RELEASE="${BUILDROOT_RELEASE:=2022.08.1}"
5+
BUILDROOT_DIR="${BUILDROOT_DIR:=/workspaces/buildroot}"
6+
7+
cd /tmp/
8+
wget "https://buildroot.org/downloads/buildroot-$BUILDROOT_RELEASE.tar.gz"
9+
tar -xf "buildroot-$BUILDROOT_RELEASE.tar.gz"
10+
mv "buildroot-$BUILDROOT_RELEASE" $BUILDROOT_DIR
11+
rm -rf "buildroot-$BUILDROOT_RELEASE.tar.gz"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
5+
6+
apt-get -q install -y \
7+
ninja-build \
8+
qemu-user-static \
9+
wget \
10+
curl \
11+
bash \
12+
bc \
13+
binutils \
14+
build-essential \
15+
bzip2 \
16+
cpio \
17+
g++ \
18+
gcc \
19+
git \
20+
gzip \
21+
libncurses5-dev \
22+
make \
23+
mercurial \
24+
whois \
25+
patch \
26+
perl \
27+
python3 \
28+
rsync \
29+
sed \
30+
tar \
31+
unzip \
32+
file \
33+
bison \
34+
flex
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SWIFT_NATIVE_TOOLS="${SWIFT_NATIVE_TOOLS:=/workspaces/swift/usr/bin}"
5+
SWIFT_LLVM_DIR="${SWIFT_LLVM_DIR:=/workspaces/llvm}"
6+
7+
# Download Swift toolchain
8+
export DEBIAN_FRONTEND=noninteractive
9+
ARCH_NAME="$(dpkg --print-architecture)"; \
10+
url=; \
11+
case "${ARCH_NAME##*-}" in \
12+
'amd64') \
13+
OS_ARCH_SUFFIX=''; \
14+
;; \
15+
'arm64') \
16+
OS_ARCH_SUFFIX='-aarch64'; \
17+
;; \
18+
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
19+
esac;
20+
21+
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX"
22+
SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_VERSION/$SWIFT_VERSION-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz"
23+
SWIFT_SIG_URL="$SWIFT_BIN_URL.sig"
24+
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
25+
export GNUPGHOME="$(mktemp -d)"
26+
curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig
27+
gpg --batch --quiet --keyserver keyserver.ubuntu.com --recv-keys "$SWIFT_SIGNING_KEY"
28+
gpg --batch --verify swift.tar.gz.sig swift.tar.gz
29+
# - Unpack the toolchain, set libs permissions, and clean up.
30+
mkdir -p $SWIFT_NATIVE_TOOLS/../../
31+
tar -xzf swift.tar.gz --directory $SWIFT_NATIVE_TOOLS/../../ --strip-components=1
32+
chmod -R o+r $SWIFT_NATIVE_TOOLS/../../usr/lib/swift
33+
rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz
34+
35+
# Download LLVM headers
36+
mkdir -p $SWIFT_LLVM_DIR
37+
cd $SWIFT_LLVM_DIR
38+
wget https://github.com/colemancda/swift-armv7/releases/download/0.4.0/llvm-swift.zip
39+
unzip llvm-swift.zip
40+
rm -rf llvm-swift.zip
41+

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# These are supported funding model platforms
2+
ko_fi: colemancda

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
**Issue**
2+
3+
Fixes #1.
4+
5+
**What does this PR Do?**
6+
7+
Description of the changes in this pull request.
8+
9+
**Where should the reviewer start?**
10+
11+
`main.swift`
12+
13+
**Sweet giphy showing how you feel about this PR**
14+
15+
![Giphy](https://media.giphy.com/media/rkDXJA9GoWR2/giphy.gif)

.github/workflows/buildroot.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Buildroot
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
name: Build Swift for Buildroot
8+
strategy:
9+
matrix:
10+
config: ["imx6slevk", "aarch64_efi", "pc_x86_64_efi"]
11+
runs-on: ubuntu-22.04
12+
container: swift:5.7-jammy
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Build
17+
run: |
18+
export SRC_ROOT=$GITHUB_WORKSPACE
19+
export DEFCONFIG=${{ matrix.config }}_swift_defconfig
20+
export SWIFT_NATIVE_TOOLS=/workspaces/swift/usr/bin
21+
export SWIFT_LLVM_DIR=/workspaces/llvm
22+
export BUILDROOT_DIR=/workspaces/buildroot
23+
export BUILDROOT_RELEASE=2022.08.1
24+
export DEBIAN_FRONTEND=noninteractive
25+
export DEBCONF_NONINTERACTIVE_SEEN=true
26+
apt update
27+
$SRC_ROOT/.devcontainer/library-scripts/install-dependencies.sh
28+
$SRC_ROOT/.devcontainer/library-scripts/install-swift.sh
29+
$SRC_ROOT/.devcontainer/build-scripts/download-buildroot.sh
30+
$SRC_ROOT/.devcontainer/build-scripts/build.sh
31+
- name: Archive Build artifacts
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: rootfs-tar
35+
path: $BUILDROOT_DIR/output/images/rootfs.tar
36+
- name: Archive Build artifacts
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: rootfs-ext2
40+
path: $BUILDROOT_DIR/output/images/rootfs.ext2

configs/aarch64_efi_swift_defconfig

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Architecture
2+
BR2_aarch64=y
3+
4+
# System
5+
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
6+
7+
## Required tools to create bootable media
8+
BR2_PACKAGE_HOST_GENIMAGE=y
9+
10+
# Bootloader
11+
BR2_TARGET_GRUB2=y
12+
BR2_TARGET_GRUB2_ARM64_EFI=y
13+
14+
# Filesystem / image
15+
BR2_TARGET_ROOTFS_EXT2=y
16+
BR2_TARGET_ROOTFS_EXT2_4=y
17+
BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
18+
# BR2_TARGET_ROOTFS_TAR is not set
19+
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/aarch64-efi/post-image.sh support/scripts/genimage.sh"
20+
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/aarch64-efi/genimage-efi.cfg"
21+
22+
# Linux headers same as kernel, a 5.15 series
23+
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
24+
25+
# Kernel
26+
BR2_LINUX_KERNEL=y
27+
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
28+
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.4"
29+
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
30+
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
31+
32+
# Host tools for genimage
33+
BR2_PACKAGE_HOST_DOSFSTOOLS=y
34+
BR2_PACKAGE_HOST_MTOOLS=y
35+
36+
# GNU C Toolchain
37+
BR2_KERNEL_HEADERS_4_9=y
38+
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
39+
BR2_TOOLCHAIN_BUILDROOT_CXX=y
40+
41+
# Vendor
42+
BR2_TOOLCHAIN_BUILDROOT_VENDOR="swift"
43+
BR2_TARGET_GENERIC_HOSTNAME="swift-linux"
44+
BR2_TARGET_GENERIC_ISSUE="Welcome to Swift Linux"
45+
46+
# Swift Runtime Libraries
47+
BR2_PACKAGE_LIBDISPATCH=y
48+
BR2_PACKAGE_SWIFT=y
49+
BR2_PACKAGE_LIBSWIFTDISPATCH=y
50+
BR2_PACKAGE_FOUNDATION=y
51+
52+
# Dependencies
53+
BR2_PACKAGE_ICU=y
54+
BR2_PACKAGE_LIBBSD=y
55+
BR2_PACKAGE_LIBMD=y
56+
BR2_PACKAGE_LIBXML2=y
57+
BR2_PACKAGE_LIBCURL=y
58+
BR2_PACKAGE_OPENSSL=y

configs/imx6slevk_swift_defconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ BR2_ARM_FPU_VFPV3=y
77
BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
88
BR2_TARGET_ROOTFS_EXT2=y
99
BR2_TARGET_ROOTFS_EXT2_4=y
10+
BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
1011
BR2_TARGET_UBOOT=y
1112
BR2_TARGET_UBOOT_BOARDNAME="mx6slevk"
1213
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
@@ -25,14 +26,14 @@ BR2_PACKAGE_HOST_DOSFSTOOLS=y
2526
BR2_PACKAGE_HOST_GENIMAGE=y
2627
BR2_PACKAGE_HOST_MTOOLS=y
2728

29+
# Device Management
30+
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
31+
2832
# GNU C Toolchain
2933
BR2_KERNEL_HEADERS_4_9=y
3034
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
3135
BR2_TOOLCHAIN_BUILDROOT_CXX=y
3236

33-
# Device Management
34-
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
35-
3637
# Vendor
3738
BR2_TOOLCHAIN_BUILDROOT_VENDOR="swift"
3839
BR2_TARGET_GENERIC_HOSTNAME="swift-linux"
@@ -44,7 +45,7 @@ BR2_PACKAGE_SWIFT=y
4445
BR2_PACKAGE_LIBSWIFTDISPATCH=y
4546
BR2_PACKAGE_FOUNDATION=y
4647

47-
# Dependnecies
48+
# Dependencies
4849
BR2_PACKAGE_ICU=y
4950
BR2_PACKAGE_LIBBSD=y
5051
BR2_PACKAGE_LIBMD=y

0 commit comments

Comments
 (0)