diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 048b7de..a962a6b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,9 +19,37 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: 40ants/setup-lisp@v1 + - name: Grant All Perms to Make Cache Restoring Possible + run: | + sudo mkdir -p /usr/local/etc/roswell + sudo chown "${USER}" /usr/local/etc/roswell + # Here the ros binary will be restored: + sudo chown "${USER}" /usr/local/bin + - name: Get Current Month + id: current-month + run: | + echo "::set-output name=value::$(date -u "+%Y-%m")" + - name: Cache Roswell Setup + id: cache + uses: actions/cache@v2 + env: + cache-name: cache-roswell + with: + path: | + /usr/local/bin/ros + ~/.cache/common-lisp/ + ~/.roswell + /usr/local/etc/roswell + .qlot + key: "${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('qlfile.lock') }}" + - name: Restore Path To Cached Files + run: | + echo $HOME/.roswell/bin >> $GITHUB_PATH + echo .qlot/bin >> $GITHUB_PATH + if: steps.cache.outputs.cache-hit == 'true' + - uses: 40ants/setup-lisp@test-cache + if: steps.cache.outputs.cache-hit != 'true' - uses: 40ants/build-docs@v1 with: asdf-system: docs # ngrok-auth-token: ${{ secrets.NGROK_AUTH_TOKEN }} - diff --git a/docs.lisp b/docs.lisp index 020ed45..5f634ff 100644 --- a/docs.lisp +++ b/docs.lisp @@ -19,6 +19,7 @@ and [Qlot](https://github.com/fukamachi/qlot) inside the Github CI. (@features section) (@typical-usage section) (@ql-file section) + (@caching section) (@roadmap section)) @@ -154,9 +155,68 @@ and [Jinja2](https://jinja.palletsprojects.com/). ") +(defsection @caching (:title "Caching") + " +Usually installing Roswell, a lisp implementation and dependencies +take from 2 to 10 minutes. Multiply this to the number of +matrix combinations and you'll get signifficant time. + +To speed up build, you can use caching using a standad GitHub action `actions/cache@v2`. + +To make caching work, add such sections into your workflow file: + +```yaml +- name: Grant All Perms to Make Cache Restoring Possible + run: | + sudo mkdir -p /usr/local/etc/roswell + sudo chown "${USER}" /usr/local/etc/roswell + # Here the ros binary will be restored: + sudo chown "${USER}" /usr/local/bin +- name: Get Current Month + id: current-month + run: | + echo "::set-output name=value::$(date -u "+%Y-%m")" +- name: Cache Roswell Setup + id: cache + uses: actions/cache@v2 + env: + cache-name: cache-roswell + with: + path: | + /usr/local/bin/ros + ~/.cache/common-lisp/ + ~/.roswell + /usr/local/etc/roswell + .qlot + key: "${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('qlfile.lock') }}" +- name: Restore Path To Cached Files + run: | + echo $HOME/.roswell/bin >> $GITHUB_PATH + echo .qlot/bin >> $GITHUB_PATH + if: steps.cache.outputs.cache-hit == 'true' +- uses: 40ants/setup-lisp@test-cache + if: steps.cache.outputs.cache-hit != 'true' +``` + +There are two important lines here. + +- The last line `if: steps.cache.outputs.cache-hit != 'true'` skips + running lisp installation, it it was take from the cache. +- The `key` value: + + ``` + key: "${{ steps.current-month.outputs.value }}-${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('qlfile.lock') }}" + ``` + + It controls when your cache will be matched. If you are using `matrix`, put all it's components + into the key. + + I also added a current month there, to make sure cache will be renewed at least monthly. + This way a new Roswell, Qlot and ASDF will be used in a build. +") + (defsection @roadmap (:title "Roadmap") " -- Make action use caching to speedup dependencies installation. - Support [CLPM](https://gitlab.common-lisp.net/clpm/clpm). - Vendor all dependencies, to make action more reliable and secure. ") diff --git a/qlfile.lock b/qlfile.lock index 89b0f94..693e173 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -5,8 +5,12 @@ ("ultralisp" . (:class qlot/source/dist:source-dist :initargs (:distribution "http://dist.ultralisp.org" :%version :latest) - :version "20210215183000")) + :version "20210224171000")) ("mgl-pax" . (:class qlot/source/github:source-github :initargs (:repos "svetlyak40wt/mgl-pax" :ref nil :branch "mgl-pax-minimal" :tag nil) - :version "github-dc8a4585d7b9fe7b4c83a4bc2f338eab")) + :version "github-6c4eecc1be34466756e6096d1c5071f5")) +("sly" . + (:class qlot/source/github:source-github + :initargs (:repos "svetlyak40wt/sly" :ref nil :branch "patches" :tag nil) + :version "github-62eaa8112b926b328a9838e7d5b21c15"))