Skip to content

Commit c31f085

Browse files
IdanHoawesomekling
authored andcommitted
CI: Cache UnicodeData files on GitHub Actions runs
This should prevent 5 unnecessary downloads for each CI run.
1 parent 13c7d55 commit c31f085

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

.github/workflows/cmake.yml

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,27 @@ jobs:
116116
# about 0.25 GB, so 1.5 GB (0.5GB after compression) should be plenty, all while comfortly fitting in the cache.
117117
ccache -M 1500M
118118
ccache -s
119+
- name: Create build directory
120+
run: |
121+
mkdir -p ${{ github.workspace }}/Build
122+
mkdir -p ${{ github.workspace }}/Build/UCD
123+
- name: UnicodeData cache
124+
# TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
125+
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
126+
with:
127+
path: ${{ github.workspace }}/Build/UCD
128+
key: UnicodeData-${{ hashFiles('Userland/Libraries/LibUnicode/unicode_data.cmake') }}
119129
- name: Create build environment with extra debug options
120-
working-directory: ${{ github.workspace }}
130+
working-directory: ${{ github.workspace }}/Build
121131
# Build the entire project with all available debug options turned on, to prevent code rot.
122132
# However, it is unweildy and slow to run tests with them enabled, so we will build twice.
123-
run: |
124-
mkdir -p Build
125-
cd Build
126-
cmake .. -GNinja -DSERENITY_ARCH=${{ matrix.arch }} -DBUILD_LAGOM=ON -DENABLE_ALL_DEBUG_FACILITIES=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
133+
run: cmake .. -GNinja -DSERENITY_ARCH=${{ matrix.arch }} -DBUILD_LAGOM=ON -DENABLE_ALL_DEBUG_FACILITIES=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
127134
if: ${{ matrix.debug-options == 'ALL_DEBUG' }}
128135
- name: Create build environment
129-
working-directory: ${{ github.workspace }}
136+
working-directory: ${{ github.workspace }}/Build
130137
# Note that we do not set BUILD_LAGOM for the normal debug build
131138
# We build and run the Lagom tests in a separate job, and sanitizer builds take a good while longer than non-sanitized.
132-
run: |
133-
mkdir -p Build
134-
cd Build
135-
cmake .. -GNinja -DSERENITY_ARCH=${{ matrix.arch }} -DENABLE_UNDEFINED_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
139+
run: cmake .. -GNinja -DSERENITY_ARCH=${{ matrix.arch }} -DENABLE_UNDEFINED_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
136140
if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }}
137141

138142
# === ACTUALLY BUILD ===
@@ -223,24 +227,31 @@ jobs:
223227

224228
# === PREPARE FOR BUILDING ===
225229

230+
- name: Create build directory
231+
run: |
232+
mkdir -p ${{ github.workspace }}/Meta/Lagom/Build
233+
mkdir -p ${{ github.workspace }}/Meta/Lagom/Build/UCD
234+
235+
- name: UnicodeData cache
236+
# TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
237+
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
238+
with:
239+
path: ${{ github.workspace }}/Meta/Lagom/Build/UCD/
240+
key: UnicodeData-${{ hashFiles('Userland/Libraries/LibUnicode/unicode_data.cmake') }}
241+
if: ${{ matrix.with-fuzzers == 'NO_FUZZ' }}
242+
226243
# TODO: ccache
227244
# https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
228245
# https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
229246
# Ignore for now, since the other step dominates
230247
- name: Create build environment (fuzz)
231-
working-directory: ${{ github.workspace }}/Meta/Lagom
232-
run: |
233-
mkdir -p Build
234-
cd Build
235-
cmake -GNinja -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
248+
working-directory: ${{ github.workspace }}/Meta/Lagom/Build
249+
run: cmake -GNinja -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
236250
if: ${{ matrix.with-fuzzers == 'FUZZ' }}
237251

238252
- name: Create build environment (no fuzz)
239-
working-directory: ${{ github.workspace }}/Meta/Lagom
240-
run: |
241-
mkdir -p Build
242-
cd Build
243-
cmake -GNinja -DBUILD_LAGOM=ON -DINCLUDE_WASM_SPEC_TESTS=ON -DWASM_SPEC_TEST_SKIP_FORMATTING=ON -DENABLE_UNDEFINED_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
253+
working-directory: ${{ github.workspace }}/Meta/Lagom/Build
254+
run: cmake -GNinja -DBUILD_LAGOM=ON -DINCLUDE_WASM_SPEC_TESTS=ON -DWASM_SPEC_TEST_SKIP_FORMATTING=ON -DENABLE_UNDEFINED_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DENABLE_USB_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
244255
if: ${{ matrix.with-fuzzers == 'NO_FUZZ' }}
245256

246257
# === ACTUALLY BUILD AND TEST ===

0 commit comments

Comments
 (0)