-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <[email protected]>
- Loading branch information
Showing
9 changed files
with
222 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
env: | ||
REPO_SLUG_ORIGIN: "moby/buildkit:master" | ||
PLATFORMS: "linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x,linux/ppc64le" | ||
CACHEKEY_BINARIES: "binaries" | ||
|
||
jobs: | ||
base: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Cache ${{ env.CACHEKEY_BINARIES }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} | ||
key: ${{ runner.os }}-buildx-${{ env.CACHEKEY_BINARIES }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx-${{ env.CACHEKEY_BINARIES }}- | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} | ||
- | ||
name: Build ${{ env.CACHEKEY_BINARIES }} | ||
run: | | ||
./hack/build_ci_first_pass binaries | ||
env: | ||
CACHEDIR_FROM: /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} | ||
CACHEDIR_TO: /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }}-new | ||
- | ||
# FIXME: Temp fix for https://github.com/moby/buildkit/issues/1850 | ||
name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} | ||
mv /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }}-new /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: [base] | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Cache ${{ env.CACHEKEY_BINARIES }} | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache/${{ env.CACHEKEY_BINARIES }} | ||
key: ${{ runner.os }}-buildx-${{ env.CACHEKEY_BINARIES }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx-${{ env.CACHEKEY_BINARIES }}- | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} | ||
- | ||
name: Test | ||
run: | | ||
make test | ||
env: | ||
TEST_COVERAGE: 1 | ||
TESTFLAGS: -v --parallel=6 --timeout=20m | ||
CACHEDIR_FROM: /tmp/.buildkit-cache/${{ env.CACHEKEY_BINARIES }} | ||
- | ||
name: Send to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage/coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Workflow used to make a request to proxy.golang.org to refresh cache on https://pkg.go.dev/github.com/docker/buildx | ||
# when a released of buildx is produced | ||
name: godev | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.13 | ||
- | ||
name: Call pkg.go.dev | ||
run: | | ||
go get github.com/${GITHUB_REPOSITORY}@${GITHUB_REF#refs/tags/} | ||
env: | ||
GO111MODULE: on | ||
GOPROXY: https://proxy.golang.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
bin | ||
cross-out | ||
coverage | ||
cross-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
comment: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
TYP=$1 | ||
|
||
. $(dirname $0)/util | ||
set -e | ||
|
||
usage() { | ||
echo "usage: ./hack/build_ci_first_pass <binaries>" | ||
exit 1 | ||
} | ||
|
||
if [ -z "$TYP" ]; then | ||
usage | ||
fi | ||
|
||
importCacheFlags="" | ||
exportCacheFlags="" | ||
if [ "$GITHUB_ACTIONS" = "true" ]; then | ||
if [ -n "$cacheRefFrom" ]; then | ||
importCacheFlags="--cache-from=type=local,src=$cacheRefFrom" | ||
fi | ||
if [ -n "$cacheRefTo" ]; then | ||
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo" | ||
fi | ||
fi | ||
|
||
case $TYP in | ||
"binaries") | ||
buildxCmd build $importCacheFlags $exportCacheFlags \ | ||
--target "binaries" \ | ||
$currentcontext | ||
;; | ||
*) | ||
echo >&2 "Unknown type $TYP" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
. $(dirname $0)/util | ||
set -eu -o pipefail -x | ||
set -eu | ||
|
||
: ${CONTINUOUS_INTEGRATION=} | ||
output=$(mktemp -d -t buildx-output.XXXXXXXXXX) | ||
|
||
progressFlag="" | ||
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi | ||
buildxCmd build \ | ||
--target "update" \ | ||
--output "type=local,dest=$output" \ | ||
--file "./hack/dockerfiles/vendor.Dockerfile" \ | ||
. | ||
|
||
case $buildmode in | ||
"buildkit") | ||
output=$(mktemp -d -t buildctl-output.XXXXXXXXXX) | ||
buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. \ | ||
--frontend-opt target=update \ | ||
--frontend-opt filename=./hack/dockerfiles/vendor.Dockerfile \ | ||
--output type=local,dest=$output | ||
rm -rf ./vendor | ||
cp -R "$output/out/" . | ||
rm -rf $output | ||
;; | ||
*) | ||
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) | ||
case $buildmode in | ||
"docker-buildkit") | ||
export DOCKER_BUILDKIT=1 | ||
docker build --iidfile $iidfile -f ./hack/dockerfiles/vendor.Dockerfile --target update --force-rm . | ||
;; | ||
*) | ||
echo "buildctl or docker with buildkit support is required" | ||
exit 1 | ||
;; | ||
esac | ||
iid=$(cat $iidfile) | ||
cid=$(docker create $iid noop) | ||
rm -rf ./vendor | ||
|
||
docker cp $cid:/out/go.mod . | ||
docker cp $cid:/out/go.sum . | ||
docker cp $cid:/out/vendor . | ||
|
||
docker rm $cid | ||
rm -f $iidfile | ||
;; | ||
esac | ||
rm -rf ./vendor | ||
cp -R "$output"/out/* . | ||
rm -rf $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters