mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-27 01:01:59 +05:30
Add shard caching to CI
This commit is contained in:
parent
4fb360b19f
commit
2b6b0e62f4
69
.github/workflows/ci.yml
vendored
69
.github/workflows/ci.yml
vendored
@ -10,39 +10,48 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install Crystal
|
# - name: Find out latest Crystal version
|
||||||
uses: oprypin/install-crystal@v1.2.4
|
# run: |
|
||||||
|
# crystal_latest=$(curl -ILs -o /dev/null -w %{url_effective} https://github.com/crystal-lang/crystal/releases/latest | grep -o '[^/]*$')
|
||||||
# - name: Cache dependencies
|
# echo "crystal_latest=$crystal_latest" >> $GITHUB_ENV
|
||||||
|
# echo $crystal_latest
|
||||||
|
#
|
||||||
|
# - name: Cache Crystal
|
||||||
# uses: actions/cache@v2
|
# uses: actions/cache@v2
|
||||||
# with:
|
# with:
|
||||||
# path: ./lib
|
# path: ./crystal-bin
|
||||||
# key: shards-${{ hashFiles('shard.lock') }} # shard.lock isn't tracked atm
|
# key: crystal-${{ env.crystal_latest }}
|
||||||
|
#
|
||||||
|
# - name: Add custom Crystal dir to path
|
||||||
|
# run: echo "./crystal-bin" >> $GITHUB_PATH
|
||||||
|
#
|
||||||
|
# - name: Find out installed Crystal version
|
||||||
|
# run: |
|
||||||
|
# if ! [ -x "$(command -v crystal)" ]; then
|
||||||
|
# crystal_installed="none"
|
||||||
|
# else
|
||||||
|
# crystal_installed=$(crystal version | grep Crystal | awk '{print $2}')
|
||||||
|
# fi
|
||||||
|
# echo "crystal_installed=$crystal_installed" >> $GITHUB_ENV
|
||||||
|
# echo $crystal_installed
|
||||||
|
|
||||||
# Docs at https://crystal-lang.org/reference/the_shards_command
|
- name: Install Crystal
|
||||||
#
|
uses: oprypin/install-crystal@v1.2.4
|
||||||
# `shards install`
|
# if: env.crystal_installed != env.crystal_latest
|
||||||
#
|
# with:
|
||||||
# Resolves and installs dependencies into the lib folder. If not already present, generates a shard.lock
|
# destination: ./crystal-bin
|
||||||
# file from resolved dependencies, locking version numbers or Git commits.
|
|
||||||
# Reads and enforces locked versions and commits if a shard.lock file is present. The install command may
|
- name: Cache Shards
|
||||||
# fail if a locked version doesn't match a requirement, but may succeed if a new dependency was added, as
|
uses: actions/cache@v2
|
||||||
# long as it doesn't generate a conflict, thus generating a new shard.lock file.
|
with:
|
||||||
#
|
path: ./lib
|
||||||
# `shards update`
|
key: shards-${{ hashFiles('shard.lock') }}
|
||||||
#
|
|
||||||
# Resolves and updates all dependencies into the lib folder again, whatever the locked versions and
|
- name: Install Shards
|
||||||
# commits in the shard.lock file. Eventually generates a new shard.lock file.
|
run: |
|
||||||
#
|
if ! shards check; then
|
||||||
# --------------------------------------------------------------------------------
|
shards install
|
||||||
#
|
fi
|
||||||
# running either `shards install` or `shards update` without a `shard.lock` file does the same thing,
|
|
||||||
# downloading shards into the `lib` folder and writing a `shard.lock` file
|
|
||||||
#
|
|
||||||
# if there is a `shard.lock` file `shards install` installs the versions from the lock file while
|
|
||||||
# `shards update` does a `shards install` that pretends there isn't a lock file present
|
|
||||||
- name: Update and install shards
|
|
||||||
run: shards update
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: crystal spec
|
run: crystal spec
|
||||||
|
Loading…
Reference in New Issue
Block a user