mirror of
https://github.com/unraid/api.git
synced 2026-02-04 23:19:04 -06:00
feat: test GHA build caching
This commit is contained in:
34
.github/workflows/pull-request.yml
vendored
34
.github/workflows/pull-request.yml
vendored
@@ -36,7 +36,8 @@ jobs:
|
||||
id: tag
|
||||
run: |
|
||||
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||
image_tag="unraid/api-builder:$git_hash"
|
||||
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
||||
image_tag="unraid/api-builder:$branch"
|
||||
echo $image_tag
|
||||
echo "tag=$image_tag" >> "$GITHUB_OUTPUT"
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
@@ -50,6 +51,16 @@ jobs:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
provenance: false
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: api
|
||||
target: builder
|
||||
push: false
|
||||
tags: unraid-api:builder
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
provenance: false
|
||||
|
||||
lint-api:
|
||||
needs: [build]
|
||||
@@ -59,14 +70,21 @@ jobs:
|
||||
working-directory: api
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
name: builder
|
||||
path: /tmp
|
||||
- name: Load image
|
||||
run: |
|
||||
docker load --input /tmp/builder.tar
|
||||
persist-credentials: true
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: api
|
||||
target: builder
|
||||
push: false
|
||||
tags: unraid-api:builder
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
provenance: false
|
||||
- name: Lint
|
||||
run: |
|
||||
docker run unraid-api:builder npm run lint
|
||||
|
||||
Reference in New Issue
Block a user