mirror of https://github.com/docker/buildx.git
				
				
				
			ci: enable cache
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									e0cffbdbdf
								
							
						
					
					
						commit
						519aca3672
					
				| 
						 | 
				
			
			@ -41,10 +41,16 @@ jobs:
 | 
			
		|||
        uses: codecov/codecov-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          file: ./coverage/coverage.txt
 | 
			
		||||
      -
 | 
			
		||||
        name: Expose GitHub Runtime
 | 
			
		||||
        uses: crazy-max/ghaction-github-runtime@v1
 | 
			
		||||
      -
 | 
			
		||||
        name: Build binaries
 | 
			
		||||
        run: |
 | 
			
		||||
          make release
 | 
			
		||||
        env:
 | 
			
		||||
          CACHE_FROM: type=gha,scope=release
 | 
			
		||||
          CACHE_TO: type=gha,scope=release
 | 
			
		||||
      -
 | 
			
		||||
        name: Upload artifacts
 | 
			
		||||
        uses: actions/upload-artifact@v2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,10 @@ jobs:
 | 
			
		|||
        uses: docker/bake-action@v1
 | 
			
		||||
        with:
 | 
			
		||||
          targets: binaries
 | 
			
		||||
          set: |
 | 
			
		||||
            *.cache-from=type=gha,scope=release
 | 
			
		||||
            *.cache-from=type=gha,scope=binaries
 | 
			
		||||
            *.cache-to=type=gha,scope=binaries
 | 
			
		||||
      -
 | 
			
		||||
        name: Rename binary
 | 
			
		||||
        run: |
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,13 +44,13 @@ FROM scratch AS test-coverage
 | 
			
		|||
COPY --from=test /tmp/coverage.txt /coverage.txt
 | 
			
		||||
 | 
			
		||||
FROM scratch AS binaries-unix
 | 
			
		||||
COPY --from=buildx-build /usr/bin/buildx /
 | 
			
		||||
COPY --link --from=buildx-build /usr/bin/buildx /
 | 
			
		||||
 | 
			
		||||
FROM binaries-unix AS binaries-darwin
 | 
			
		||||
FROM binaries-unix AS binaries-linux
 | 
			
		||||
 | 
			
		||||
FROM scratch AS binaries-windows
 | 
			
		||||
COPY --from=buildx-build /usr/bin/buildx /buildx.exe
 | 
			
		||||
COPY --link --from=buildx-build /usr/bin/buildx /buildx.exe
 | 
			
		||||
 | 
			
		||||
FROM binaries-$TARGETOS AS binaries
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								hack/release
								
								
								
								
							
							
						
						
									
										15
									
								
								hack/release
								
								
								
								
							| 
						 | 
				
			
			@ -4,9 +4,22 @@ set -eu -o pipefail
 | 
			
		|||
 | 
			
		||||
: ${BUILDX_CMD=docker buildx}
 | 
			
		||||
: ${RELEASE_OUT=./release-out}
 | 
			
		||||
: ${CACHE_FROM=}
 | 
			
		||||
: ${CACHE_TO=}
 | 
			
		||||
 | 
			
		||||
if [ -n "$CACHE_FROM" ]; then
 | 
			
		||||
  for cfrom in $CACHE_FROM; do
 | 
			
		||||
    cacheFlags+=(--set "*.cache-from=$cfrom")
 | 
			
		||||
  done
 | 
			
		||||
fi
 | 
			
		||||
if [ -n "$CACHE_TO" ]; then
 | 
			
		||||
  for cto in $CACHE_TO; do
 | 
			
		||||
    cacheFlags+=(--set "*.cache-to=$cto")
 | 
			
		||||
  done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# release
 | 
			
		||||
(set -x ; ${BUILDX_CMD} bake --set "*.output=$RELEASE_OUT" release)
 | 
			
		||||
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$RELEASE_OUT" release)
 | 
			
		||||
 | 
			
		||||
# wrap binaries
 | 
			
		||||
mv -f ./${RELEASE_OUT}/**/* ./${RELEASE_OUT}/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue