diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e1fe6bee8..7b7c20209 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,17 +20,23 @@ jobs: - ubuntu-latest - macos-latest steps: + - uses: actions/cache@v3 + with: + path: ~/.cache/ccache + key: 0-${{ format( 'cache-{0}', matrix.os) }}-${{ github.run_id }} + restore-keys: | + 0-${{ format( 'cache-{0}', matrix.os) }} - uses: actions/checkout@v1 with: submodules: true - - name: Install ninja (macOS) - run: brew install ninja + - name: Install ccache, ninja (macOS) + run: brew install ccache ninja if: matrix.os == 'macos-latest' - - name: Install ninja (Linux) - run: sudo apt install ninja-build + - name: Install ccache, ninja (Linux) + run: sudo apt install ccache ninja-build if: matrix.os == 'ubuntu-latest' - name: Build - run: NINJA_FLAGS=-v make package + run: NINJA_FLAGS=-v make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON shell: bash - name: Run the testsuite run: NINJA_FLAGS=-v make check @@ -55,11 +61,18 @@ jobs: sys: clang32 env: clang-i686 steps: + - uses: actions/cache@v3 + with: + path: ~/AppData/Local/ccache + key: 0-${{ format( 'cache-windows-latest-{0}', matrix.arch) }}-${{ github.run_id }} + restore-keys: | + 0-${{ format( 'cache-windows-latest-{0}', matrix.arch) }} - uses: msys2/setup-msys2@v2 with: install: >- base-devel git + mingw-w64-${{ matrix.env }}-ccache mingw-w64-${{ matrix.env }}-cmake mingw-w64-${{ matrix.env }}-ninja mingw-w64-${{ matrix.env }}-toolchain @@ -73,7 +86,7 @@ jobs: - name: Build shell: msys2 {0} run: | - make package + make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON make check - name: Does it work sans msys2? run: | @@ -91,6 +104,13 @@ jobs: name: Docker Build runs-on: ubuntu-latest steps: + - uses: actions/cache@v3 + with: + path: ~/.cache/ccache + key: 0-cache-ubuntu-bionic-${{ github.run_id }} + restore-keys: | + 0-cache-ubuntu-bionic + - uses: actions/checkout@v1 with: submodules: true @@ -121,7 +141,7 @@ jobs: uses: actions/upload-artifact@v1 with: # Upload the dist folder. Give it a name according to the OS it was built for. - name: dist-ubuntu-xenial + name: dist-ubuntu-bionic path: dist - name: Build and push wasi-sdk docker image diff --git a/Dockerfile b/Dockerfile index 43ef870ee..cfe9f05ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM ubuntu:bionic RUN apt-get update \ && apt-get install -y --no-install-recommends \ + ccache \ curl \ ca-certificates \ build-essential \ diff --git a/Makefile b/Makefile index 474561416..9829239d3 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ build/llvm.BUILT: -DLLVM_STATIC_LINK_CXX_STDLIB=ON \ -DLLVM_HAVE_LIBXAR=OFF \ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + $(LLVM_CMAKE_FLAGS) \ -DCMAKE_INSTALL_PREFIX=$(PREFIX) \ -DLLVM_TARGETS_TO_BUILD=WebAssembly \ -DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi \ diff --git a/docker_build.sh b/docker_build.sh index eab00f3bf..e30ae7e9d 100755 --- a/docker_build.sh +++ b/docker_build.sh @@ -3,4 +3,5 @@ set -e echo "Building the docker" docker build -t wasi-sdk-builder:latest . echo "Building the package in docker" -docker run --mount type=bind,src=$PWD,target=/workspace -e NINJA_FLAGS=-v --workdir /workspace wasi-sdk-builder:latest make package +mkdir -p ~/.cache/ccache +docker run --mount type=bind,src=$PWD,target=/workspace -e NINJA_FLAGS=-v --workdir /workspace -v ~/.cache/ccache:/root/.cache/ccache wasi-sdk-builder:latest make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON