summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorsaltycrys <73420320+saltycrys@users.noreply.github.com>2020-12-02 04:40:13 +0100
committersaltycrys <73420320+saltycrys@users.noreply.github.com>2020-12-02 04:40:13 +0100
commit2b6b0e62f4526063c71c225ffeea5ebdb98c74c6 (patch)
tree18fb9203f1809ad6f897e4eab278e7c6e418932b /.github
parent4fb360b19f6c185eafd0ebd47a858fb501ec1776 (diff)
downloadinvidious-2b6b0e62f4526063c71c225ffeea5ebdb98c74c6.tar.gz
invidious-2b6b0e62f4526063c71c225ffeea5ebdb98c74c6.tar.bz2
invidious-2b6b0e62f4526063c71c225ffeea5ebdb98c74c6.zip
Add shard caching to CI
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml67
1 files changed, 38 insertions, 29 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d18998b1..1f553807 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,39 +10,48 @@ jobs:
steps:
- uses: actions/checkout@v2
- - name: Install Crystal
- uses: oprypin/install-crystal@v1.2.4
-
- # - name: Cache dependencies
+ # - name: Find out latest Crystal version
+ # run: |
+ # crystal_latest=$(curl -ILs -o /dev/null -w %{url_effective} https://github.com/crystal-lang/crystal/releases/latest | grep -o '[^/]*$')
+ # echo "crystal_latest=$crystal_latest" >> $GITHUB_ENV
+ # echo $crystal_latest
+ #
+ # - name: Cache Crystal
# uses: actions/cache@v2
# with:
- # path: ./lib
- # key: shards-${{ hashFiles('shard.lock') }} # shard.lock isn't tracked atm
-
- # Docs at https://crystal-lang.org/reference/the_shards_command
- #
- # `shards install`
- #
- # Resolves and installs dependencies into the lib folder. If not already present, generates a shard.lock
- # 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
- # fail if a locked version doesn't match a requirement, but may succeed if a new dependency was added, as
- # long as it doesn't generate a conflict, thus generating a new shard.lock file.
- #
- # `shards update`
- #
- # Resolves and updates all dependencies into the lib folder again, whatever the locked versions and
- # commits in the shard.lock file. Eventually generates a new shard.lock file.
+ # path: ./crystal-bin
+ # key: crystal-${{ env.crystal_latest }}
#
- # --------------------------------------------------------------------------------
+ # - name: Add custom Crystal dir to path
+ # run: echo "./crystal-bin" >> $GITHUB_PATH
#
- # 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: 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
+
+ - name: Install Crystal
+ uses: oprypin/install-crystal@v1.2.4
+ # if: env.crystal_installed != env.crystal_latest
+ # with:
+ # destination: ./crystal-bin
+
+ - name: Cache Shards
+ uses: actions/cache@v2
+ with:
+ path: ./lib
+ key: shards-${{ hashFiles('shard.lock') }}
+
+ - name: Install Shards
+ run: |
+ if ! shards check; then
+ shards install
+ fi
- name: Run tests
run: crystal spec