Merge pull request #1 from 40ants/test-cache

Caching dependencies.
This commit is contained in:
Alexander Artemenko 2021-02-25 11:46:07 +03:00 committed by GitHub
commit 100da2a5da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 97 additions and 5 deletions

View file

@ -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 }}

View file

@ -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.
")

View file

@ -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"))