feat(github_actions): Consolidate apt cache directory

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
This commit is contained in:
Lucas Schwiderski 2021-03-26 18:53:08 +01:00
parent 9bc8c28c90
commit 645156b3c0
No known key found for this signature in database
GPG Key ID: AA12679AAA6DF4D8
2 changed files with 6 additions and 14 deletions

View File

@ -28,17 +28,14 @@ jobs:
id: get-date id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")" run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
- name: Create apt cache directory
run: mkdir /tmp/apt
- name: Cache apt packages - name: Cache apt packages
id: cache-apt id: cache-apt
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: /tmp/apt/*.deb path: /var/cache/apt/archives
# The trailing number serves as a version flag that can be incremented # The trailing number serves as a version flag that can be incremented
# to invalidate the cache after changing the list of packages. # to invalidate the cache after changing the list of packages.
key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-2 key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-3
- name: Download apt packages - name: Download apt packages
if: steps.cache-apt.outputs.cache-hit != 'true' if: steps.cache-apt.outputs.cache-hit != 'true'
@ -75,11 +72,10 @@ jobs:
xutils-dev \ xutils-dev \
liblua5.3-dev \ liblua5.3-dev \
lua5.3 lua5.3
sudo mv /var/cache/apt/archives/*.deb /tmp/apt/
- name: Install downloaded packages - name: Install downloaded packages
run: | run: |
sudo dpkg -i /tmp/apt/*.deb sudo dpkg -i /var/cache/apt/archives/*.deb
- name: Cache luarocks - name: Cache luarocks
id: cache-luarocks id: cache-luarocks

View File

@ -79,17 +79,14 @@ jobs:
id: get-date id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")" run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
- name: Create apt cache directory
run: mkdir /tmp/apt
- name: Cache apt packages - name: Cache apt packages
id: cache-apt id: cache-apt
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: /tmp/apt/*.deb path: /var/cache/apt/archives
# The trailing number serves as a version flag that can be incremented # The trailing number serves as a version flag that can be incremented
# to invalidate the cache after changing the list of packages. # to invalidate the cache after changing the list of packages.
key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-3 key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-4
- name: Download apt packages - name: Download apt packages
if: steps.cache-apt.outputs.cache-hit != 'true' if: steps.cache-apt.outputs.cache-hit != 'true'
@ -134,10 +131,9 @@ jobs:
xvfb \ xvfb \
zsh \ zsh \
lua-discount lua-discount
sudo mv /var/cache/apt/archives/*.deb /tmp/apt/
- name: Install downloaded packages - name: Install downloaded packages
run: sudo dpkg -i /tmp/apt/*.deb run: sudo dpkg -i /var/cache/apt/archives/*.deb
- name: Install Lua packages - name: Install Lua packages
run: | run: |