diff --git a/.github/workflows/UbuntuDockerfile b/.github/workflows/UbuntuDockerfile new file mode 100644 index 000000000000..1f64d6290c89 --- /dev/null +++ b/.github/workflows/UbuntuDockerfile @@ -0,0 +1,59 @@ +FROM ubuntu:22.04 + +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/London +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + curl \ + gcc \ + g++ \ + make \ + htop \ + jq \ + ninja-build \ + tmux \ + git \ + wget \ + patch \ + python3-minimal \ + python-is-python3 \ + libdata-dumper-simple-perl \ + unzip + +RUN apt-get install -y software-properties-common && \ + apt-get update && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get install -f -y gcc-12 g++-12 && \ + apt-get install -f -y llvm-14 clang-14 && \ + apt-get install -f -y llvm-15 clang-15 + +# Install the tools for release_13x and newer +RUN apt --fix-missing update && \ + apt install -y build-essential manpages-dev \ + libssl-dev zlib1g-dev \ + libbz2-dev libreadline-dev libsqlite3-dev libncurses5-dev && \ + apt install -y python3-distutils python3-psutil \ + libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl + +RUN cd /opt && \ + wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-aarch64.sh && \ + /bin/sh cmake-3.20.0-linux-aarch64.sh --skip-license --include-subdir && \ + ln -s /opt/cmake-3.20.0-linux-aarch64/bin/* /usr/local/bin + +RUN ln -s /usr/bin/ninja-build /usr/local/bin/ninja + +RUN mkdir /home/github/ + +ARG BRANCH_NAME +ARG INITIAL_BUILD +RUN if [ "$INITIAL_BUILD" != "true" ]; then \ + mkdir /home/root && cd home/root && \ + git clone --depth 1 --single-branch --branch $BRANCH_NAME https://github.com/flang-compiler/classic-flang-llvm-project.git classic-flang-llvm-project && \ + cd classic-flang-llvm-project && \ + ./build-llvm-project.sh -t AArch64 -p /home/github/usr/local -n `nproc --ignore=1` -a /usr/bin/gcc-12 -b /usr/bin/g++-12 -i -v; \ + fi + +RUN useradd github && \ + chown -R github:github /home/github +USER github diff --git a/.github/workflows/build_push_docker_image_Ubuntu.yml b/.github/workflows/build_push_docker_image_Ubuntu.yml new file mode 100644 index 000000000000..9098fa7088e8 --- /dev/null +++ b/.github/workflows/build_push_docker_image_Ubuntu.yml @@ -0,0 +1,49 @@ +name: Pre-compile llvm ARM64 + +on: + workflow_dispatch: + inputs: + initialBuild: + description: "True if creating an initial Docker image for this branch" + required: true + type: boolean + push: + branches: + - 'release_*x' + paths-include: + - '**/.github/workflows/build_push_docker_image_Ubuntu.yml' + - '**/.github/workflows/UbuntuDockerfile.yml' + +jobs: + docker: + runs-on: self-hosted + steps: + - name: Extract branch name + run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}" + id: extract_branch + + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + file: .github/workflows/UbuntuDockerfile + push: true + no-cache: true + context: .github/workflows + tags: ghcr.io/${{ github.repository_owner }}/ubuntu-flang-${{ steps.extract_branch.outputs.branch }}:latest + platforms: linux/arm64 + build-args: | + BRANCH_NAME=${{ steps.extract_branch.outputs.branch }} + INITIAL_BUILD=${{ inputs.initialBuild }}