Skip to content

Support Amazon Linux 2 for SwiftWasm distribution #2654

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 15 commits into from
Feb 13, 2021

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Feb 4, 2021

We can build the toolchain with below Dockerfile

FROM amazonlinux:2

WORKDIR /home/ec2-user

# The build needs a package from the EPEL repo so that needs to be enabled.
# https://www.tecmint.com/install-epel-repository-on-centos/
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# Update and install needed build packages
RUN yum -y update
RUN yum -y group install "development tools"
RUN yum -y install \
      git cmake clang python swig uuid-devel libicu-devel libedit-devel \
      libxml2-devel sqlite-devel ncurses-devel pkgconfig python-devel \
      python-pkgconfig libbsd-devel libuuid-devel pexpect curl-devel \
      tzdata rsync wget which python-six ninja-build
RUN ln -s /usr/bin/ninja-build /usr/bin/ninja

# Grab an updated version of cmake
RUN wget https://cmake.org/files/v3.16/cmake-3.16.5-Linux-x86_64.tar.gz \
      && tar xvzf cmake-3.16.5-Linux-x86_64.tar.gz \
      && rm cmake-3.16.5-Linux-x86_64.tar.gz

# Add updated version of cmake to path 
ENV PATH="/home/ec2-user/cmake-3.16.5-Linux-x86_64/bin/:${PATH}"


# Bootstrap the swift source and do a full checkout
RUN git clone https://github.com/swiftwasm/swift.git
WORKDIR /home/ec2-user/swift
RUN ./utils/update-checkout --clone --scheme wasm
RUN mkdir /opt/sccache && cd /opt/sccache && \
    wget -O - "https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz" | \
      tar xz --strip-components 1 && \
    ln -sf /opt/sccache/sccache /usr/local/bin
RUN ./utils/webassembly/install-wasi-sdk.sh linux ubuntu-18.04

RUN ./utils/webassembly/build-toolchain.sh

@kateinoigakukun kateinoigakukun linked an issue Feb 4, 2021 that may be closed by this pull request
@MaxDesiatov
Copy link

Does this fully resolve #2318?

@kateinoigakukun
Copy link
Member Author

Yes 👍

@MaxDesiatov
Copy link

Do you think that we'll be able to build it within a Docker image on GitHub Actions, or do we need a real Amazon EC2 VM to get CI set up for this?

@kateinoigakukun kateinoigakukun force-pushed the katei/support-amzlinux branch 3 times, most recently from 756ce6c to 92669a8 Compare February 4, 2021 15:21
@kateinoigakukun
Copy link
Member Author

I think we don't need EC2 instance and it can be built on Docker on GitHub Actions.

@kateinoigakukun
Copy link
Member Author

Building... https://github.com/swiftwasm/swift/actions/runs/537548641

@kateinoigakukun kateinoigakukun force-pushed the katei/support-amzlinux branch 3 times, most recently from 72d7c76 to c3b6ecf Compare February 6, 2021 01:41
@kateinoigakukun
Copy link
Member Author

Hmm, it seems impossible to build toolchain for amazonlinux2 on docker on GitHub Actions due to the time limit 😢

@kateinoigakukun
Copy link
Member Author

kateinoigakukun commented Feb 12, 2021

@MaxDesiatov It's ready to merge.
I set up https://github.com/swiftwasm/swiftwasm-buildbot which is an internal repository to build amazonlinux2 toolchain on my self-hosted runner. And this repository's nightly ci will trigger the buildbot workflow automatically.

This build pipeline can be also used for M1 toolchain, I think

Copy link

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit 👍

Is there an easy way to observe logs, test results, and download distributions for a given CI run on the buildbot?

@kateinoigakukun
Copy link
Member Author

@kateinoigakukun kateinoigakukun merged commit 78ffdc9 into swiftwasm Feb 13, 2021
@kateinoigakukun kateinoigakukun deleted the katei/support-amzlinux branch February 13, 2021 00:25
kateinoigakukun added a commit that referenced this pull request Mar 22, 2021
* Support Amazon Linux 2 for SwiftWasm distribution

* Setup Amazon Linux CI

* Refactoring CI script

* Fetch merge commit from GitHub

* Rename ci yaml file

* Fix e2e preparation script

* Add missing swift-crypto info for checking out

* Stop build toolchain for amazonlinux on CI

* Update actions/checkout to v2

* Remove duplicated unzip from distribution script

* Checkout with given scheme

* Dispatch buildbot repo event after creating a new tag

* Add branch name as workflow input

* Use actions/checkout v2

* Use SWIFTWASM_BUILDBOT_TOKEN to trigger buildbot ci
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Amazon Linux on x86_64
2 participants