Browse Source

Cache swift-format (#1887)

Motivation:

The CI takes ~7 minutes to run, the longest job is the formatting check
which spends most of its time compiling swift-format.

Modifications:

- Cache the swift-format build directory

Result:

Faster CI
George Barnett 1 year ago
parent
commit
73a34ffc0f
2 changed files with 12 additions and 0 deletions
  1. 8 0
      .github/workflows/ci.yaml
  2. 4 0
      scripts/license-check.sh

+ 8 - 0
.github/workflows/ci.yaml

@@ -12,9 +12,17 @@ jobs:
       image: swift
     steps:
     - uses: actions/checkout@v4
+    - uses: actions/cache/restore@v4
+      with:
+        path: scripts/.swift-format-source
+        key: ${{ runner.os }}-swift-format
     - name: "Formatting and License Headers check"
       run: |
         ./scripts/sanity.sh
+    - uses: actions/cache/save@v4
+      with:
+        path: scripts/.swift-format-source
+        key: ${{ runner.os }}-swift-format
   unit-tests:
     strategy:
       fail-fast: false

+ 4 - 0
scripts/license-check.sh

@@ -102,6 +102,10 @@ check_copyright_headers() {
     ! -name '*.grpc.swift' \
     ! -name 'LinuxMain.swift' \
     ! -name 'XCTestManifests.swift' \
+    ! -path './FuzzTesting/.build/*' \
+    ! -path './Performance/QPSBenchmark/.build/*' \
+    ! -path './Performance/Benchmarks/.build/*' \
+    ! -path './scripts/.swift-format-source/*' \
     ! -path './.build/*')
 }