diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..80442ca --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,49 @@ +name: Unix Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + release: + types: + - published + +jobs: + docker: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Docker setup-buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Docker Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=edge + - name: Docker build and push + uses: docker/build-push-action@v2 + with: + push: true + context: . + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d672ba5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +FROM ubuntu:20.04 AS build-env + +ENV ASAN_SYMBOLIZER_PATH="/usr/lib/llvm-14/bin/llvm-symbolizer" +ENV ASAN_OPTIONS="alloc_dealloc_mismatch=0" +ENV UBSAN_OPTIONS="halt_on_error=1:abort_on_error=1" +ENV DEBIAN_FRONTEND="noninteractive" +ENV BUILDCACHE_COMPRESS="true" +ENV BUILDCACHE_DIRECT_MODE="true" +ENV BUILDCACHE_ACCURACY="SLOPPY" +ENV PATH="/opt:/opt/cmake-3.23.0-rc3-linux-x86_64/bin:/opt/buildcache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# BASE SETUP +RUN apt-get update && \ + apt-get install -y --no-install-recommends apt-utils && \ + apt-get install -y --no-install-recommends software-properties-common xz-utils wget gnupg2 ca-certificates software-properties-common && \ + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + git wget gnupg2 \ + valgrind \ + ninja-build qemu-user-static \ + g++-10 gcc-10 + +# INSTALL CLANG +RUN add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" && \ + apt-get install -y --no-install-recommends clang-14 lldb-14 lld-14 clangd-14 clang-tidy-14 clang-format-14 clang-tools-14 llvm-14-dev llvm-14-tools libomp-14-dev libc++-14-dev libc++abi-14-dev libclang-common-14-dev libclang-14-dev libclang-cpp14-dev libunwind-14-dev + +# INSTALL MOLD LINKER +RUN wget https://github.com/motis-project/mold/releases/download/v1.0.0-musl-strip/mold-linux-amd64 && \ + mkdir -p /opt/mold && \ + mv mold-linux-amd64 /opt/mold/ld && \ + chmod +x /opt/mold/ld + +# INSTALL ELM 0.18 +RUN wget https://github.com/elm-lang/elm-platform/releases/download/0.18.0-exp/elm-platform-linux-64bit.tar.gz && \ + tar xf elm-platform-linux-64bit.tar.gz -C /opt + +# INSTALL CROSS-PLATFORM TOOLCHAINS +RUN wget https://github.com/motis-project/musl-toolchains/releases/download/0.0.10/aarch64-unknown-linux-musl.tar.xz && \ + tar xf aarch64-unknown-linux-musl.tar.xz -C /opt && \ + rm -rf aarch64-unknown-linux-musl.tar.xz && \ + wget https://github.com/motis-project/musl-toolchains/releases/download/0.0.10/arm-unknown-linux-musleabihf.tar.xz && \ + tar xf arm-unknown-linux-musleabihf.tar.xz -C /opt && \ + rm -rf arm-unknown-linux-musleabihf.tar.xz && \ + wget https://github.com/motis-project/musl-toolchains/releases/download/0.0.10/x86_64-multilib-linux-musl.tar.xz && \ + tar xf x86_64-multilib-linux-musl.tar.xz -C /opt && \ + rm -rf x86_64-multilib-linux-musl.tar.xz + +# INSTALL CMAKE +RUN wget https://github.com/Kitware/CMake/releases/download/v3.23.0-rc3/cmake-3.23.0-rc3-linux-x86_64.tar.gz &&\ + tar xf cmake-3.23.0-rc3-linux-x86_64.tar.gz -C /opt + +# INSTALL PKG +RUN wget https://github.com/motis-project/pkg/releases/download/v0.14/pkg-linux-amd64 -O /opt/pkg && \ + chmod +x /opt/pkg + +# INSTALL BUILDCACHE +RUN wget https://github.com/mbitsnbites/buildcache/releases/download/v0.27.6/buildcache-linux.tar.gz && \ + tar xf buildcache-linux.tar.gz -C /opt \ No newline at end of file