Skip to content

Commit

Permalink
Enable ccache for CI builds of LLVM
Browse files Browse the repository at this point in the history
  • Loading branch information
TerrorJack committed Jan 2, 2023
1 parent 646cac5 commit b14be46
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/main.yml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -5,6 +5,7 @@ FROM ubuntu:bionic

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ccache \
curl \
ca-certificates \
build-essential \
Expand Down
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -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 \
Expand Down
3 changes: 2 additions & 1 deletion docker_build.sh
Expand Up @@ -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

0 comments on commit b14be46

Please sign in to comment.