Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for caching with Github Actions cache #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ name: Unit Tests
on: [push, pull_request]

jobs:
testactions_cache:
runs-on: ubuntu-latest
strategy:
matrix:
githubToken: [true, false]
githubActionsCache: [true, false]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and run container
id: build
uses: ./
with:
githubActionsCache: '${{ matrix.githubActionsCache }}'
githubToken: "${{ matrix.githubToken && github.token || '' }}"
arch: aarch64
distro: bullseye
run: |
echo "Ran successfully"

testactions_job:
runs-on: ubuntu-latest
name: Test
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode/
.vscode/
.idea/
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ This action requires three input parameters:

The action also accepts some optional input parameters:

* `githubToken`: Your GitHub token, used for caching Docker images in your project's public package registry. Usually this would just be `${{ github.token }}`. This speeds up subsequent builds and is highly recommended.
* `githubActionsCache`: Set to `true` to cache with GitHub Actions cache instead of GitHub Package Registry. This speeds up subsequent builds and is highly recommended.
* `githubToken`: Your GitHub token, used for caching Docker images in your project's public package registry rather than using GitHub Actions cache. Usually this would just be `${{ github.token }}`.
* `env`: Environment variables to propagate to the container. YAML, but must begin with a `|` character. These variables will be available in both run and setup.
* `shell`: The shell to run commands with in the container. Default: `/bin/sh` on Alpine, `/bin/bash` for other distros.
* `dockerRunArgs`: Additional arguments to pass to `docker run`, such as volume mappings. See [`docker run` documentation](https://docs.docker.com/engine/reference/commandline/run).
Expand All @@ -36,6 +37,11 @@ jobs:
name: Build on ubuntu-22.04 armv7
steps:
- uses: actions/checkout@v4

# Only required if you are using the GitHub Actions cache.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
Expand All @@ -44,8 +50,8 @@ jobs:
distro: ubuntu22.04

# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}
# the GitHub Actions cache between runs.
githubActionsCache: 'true'

# Set an output parameter `uname` for use in subsequent steps
run: |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ inputs:
description: 'Your GitHub token, used for caching Docker images in your project''s public package registry. Usually this would just be $\{{ github.token }}. This speeds up builds and is highly recommended.'
required: false
default: ''
githubActionsCache:
description: 'Your GitHub Actions cache, used for caching Docker images in your project''s public package registry. This speeds up builds and is highly recommended.'
required: false
type: boolean
default: false
env:
description: 'Environment variables to propagate to the container. YAML, but must begin with a | character. These variables will be available in both run and setup.'
required: false
Expand Down
1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/@actions/core/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading