]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
👷 Add GitHub Action cache to speed up CI installs (#3204)
authorSebastián Ramírez <tiangolo@gmail.com>
Mon, 10 May 2021 08:10:48 +0000 (10:10 +0200)
committerGitHub <noreply@github.com>
Mon, 10 May 2021 08:10:48 +0000 (10:10 +0200)
.github/workflows/build-docs.yml
.github/workflows/publish.yml
.github/workflows/test.yml

index 72e2da1070c4b3087365a2d91fd5dc450f7d344e..ad20f45b484373f7490f0d12b3d353eabfc64089 100644 (file)
@@ -16,12 +16,19 @@ jobs:
         uses: actions/setup-python@v2
         with:
           python-version: "3.7"
+      - uses: actions/cache@v2
+        id: cache
+        with:
+          path: ${{ env.pythonLocation }}
+          key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs
       - name: Install Flit
+        if: steps.cache.outputs.cache-hit != 'true'
         run: python3.7 -m pip install flit
       - name: Install docs extras
+        if: steps.cache.outputs.cache-hit != 'true'
         run: python3.7 -m flit install --extras doc
       - name: Install Material for MkDocs Insiders
-        if: github.event.pull_request.head.repo.fork == false
+        if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true'
         run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
       - name: Build Docs
         run: python3.7 ./scripts/docs.py build-all
index 43f086e53781e5006f2fe7e845a32ccb15c06dcb..9dde4e066c59f88f58b30290552b6634685da398 100644 (file)
@@ -18,9 +18,16 @@ jobs:
         uses: actions/setup-python@v2
         with:
           python-version: "3.6"
+      - uses: actions/cache@v2
+        id: cache
+        with:
+          path: ${{ env.pythonLocation }}
+          key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
       - name: Install Flit
+        if: steps.cache.outputs.cache-hit != 'true'
         run: pip install flit
       - name: Install Dependencies
+        if: steps.cache.outputs.cache-hit != 'true'
         run: flit install --symlink
       - name: Publish
         env:
index 88fa290d541c364dd80e23308be3bbfdf6223c4e..f346cab6be363a1e43ce7dfeb5434ad72d8212c2 100644 (file)
@@ -19,9 +19,16 @@ jobs:
         uses: actions/setup-python@v2
         with:
           python-version: ${{ matrix.python-version }}
+      - uses: actions/cache@v2
+        id: cache
+        with:
+          path: ${{ env.pythonLocation }}
+          key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test
       - name: Install Flit
+        if: steps.cache.outputs.cache-hit != 'true'
         run: pip install flit
       - name: Install Dependencies
+        if: steps.cache.outputs.cache-hit != 'true'
         run: flit install --symlink
       - name: Test
         run: bash scripts/test.sh