cache-apt-pkgs-action/README.md

65 lines
2.7 KiB
Markdown
Raw Normal View History

2021-10-14 04:11:27 +00:00
# cache-apt-pkgs-action
[![License: Apache2](https://shields.io/badge/license-apache2-blue.svg)](https://github.com/awalsh128/fluentcpp/blob/master/LICENSE)
2021-10-14 05:19:26 +00:00
[![GitHub Tests status](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/tests.yml/badge.svg)](https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/workflows/tests.yml)
2021-10-14 04:11:27 +00:00
2021-10-16 17:19:15 +00:00
This action allows caching of Advanced Package Tool (APT) package dependencies to improve workflow execution time instead of installing the packages on every run.
2021-10-14 04:11:27 +00:00
## Documentation
2021-10-14 05:08:02 +00:00
2021-10-14 04:11:27 +00:00
This action is a composition of [actions/cache](https://github.com/actions/cache/README.md) and the `apt` utility. Some actions require additional APT based packages to be installed in order for other steps to be executed. Packages can be installed when ran but can consume much of the execution workflow time.
## Usage
### Pre-requisites
Create a workflow `.yml` file in your repositories `.github/workflows` directory. An [example workflow](#example-workflow) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
### Inputs
* `packages` - Space delimited list of packages to install.
* `version` - Version of cache to load. Each version will have its own cache. Note, all characters except spaces are allowed.
2021-10-14 04:11:27 +00:00
### Outputs
* `cache-hit` - A boolean value to indicate a cache was found for the packages requested.
### Cache scopes
The cache is scoped to the packages given and the branch. The default branch cache is available to other branches.
2021-10-14 04:11:27 +00:00
### Example workflow
This was a motivating use case for creating this action.
```yaml
2021-10-16 17:19:15 +00:00
name: Create Documentation
2021-10-14 04:11:27 +00:00
on: push
jobs:
build_and_deploy_docs:
runs-on: ubuntu-latest
name: Build Doxygen documentation and deploy
steps:
- uses: actions/checkout@v2
2021-10-15 00:38:13 +00:00
- uses: awalsh128/cache-apt-pkgs-action@v1
2021-10-14 04:11:27 +00:00
with:
packages: dia doxygen doxygen-doc doxygen-gui doxygen-latex graphviz mscgen
version: 1.0
2021-10-14 04:11:27 +00:00
- name: Build
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: ${{github.workspace}}/build/website
```
## Cache Limits
A repository can have up to 5GB of caches. Once the 5GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.