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

docker workflow: add javascript mode for cache #146

Merged
merged 12 commits into from
Dec 16, 2024
32 changes: 28 additions & 4 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ on:
default: false
type: boolean
description: Use go caching mechanism
language-cache:
required: false
type: string
default: ''
description: Use caching mechanism for a given language

# Permissions needed
# permissions:
Expand Down Expand Up @@ -94,21 +99,40 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Go Build Cache for Docker
id: cache
if: ${{ inputs.go-cache }}
id: cache-go
if: ${{ inputs.go-cache || inputs.language-cache == 'go' }}
uses: actions/cache@v4
with:
path: go-build-cache
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}
- name: inject go-build-cache into docker
if: ${{ inputs.go-cache }}
if: ${{ inputs.go-cache || inputs.language-cache == 'go' }}
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"go-build-cache": "/root/.cache/go-build"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
skip-extraction: ${{ steps.cache-go.outputs.cache-hit }}
- name: Node Build Cache for Docker
id: cache-node
if: ${{ inputs.language-cache == 'javascript' }}
uses: actions/cache@v4
with:
path: |
node-arm64-cache
node-amd64-cache
key: ${{ runner.os }}-node-build-cache-${{ hashFiles('**/yarn.lock') }}
- name: inject node-build-cache into docker
if: ${{ inputs.language-cache == 'javascript' }}
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"node-arm64-cache": "/root/.cache/yarn-arm64",
"node-amd64-cache": "/root/.cache/yarn-amd64"
}
skip-extraction: ${{ steps.cache-node.outputs.cache-hit }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- Add workflow to create a new release (PR #145 by @chicco785)
- docker workflow: add javascript mode for cache (PR #146 by @chicco785)
- golang workflow: include `.sql` and `.docker/*.yml` files in golang changes
filter (PR #142 by @chicco785)
- Golang & Docker workflows: add db caching to trivy (PR #138 by @chicco785)
Expand Down
Loading