-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
8 changed files
with
277 additions
and
135 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,180 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- "ghactions-test" #remove when merged | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
- 'dockerfile/*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
env: | ||
REPO_SLUG_ORIGIN: "moby/buildkit:latest" | ||
|
||
jobs: | ||
test-base: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Cache integration-tests | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildkit-cache/integration-tests | ||
key: ${{ runner.os }}-buildkit-integration-tests-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildkit-integration-tests- | ||
- | ||
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 integration-tests | ||
run: | | ||
./hack/build_ci_first_pass integration-tests | ||
env: | ||
CACHE_DIR: /tmp/.buildkit-cache/integration-tests | ||
- | ||
name: Dump context | ||
if: always() | ||
uses: crazy-max/ghaction-dump-context@v1 | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: [ test-base ] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- | ||
pkg: ./client | ||
flags: -v --timeout=20m | ||
skip-it: 0 | ||
typ: integration | ||
- | ||
pkg: ./cmd/buildctl | ||
flags: -v | ||
skip-it: 0 | ||
typ: integration | ||
- | ||
pkg: ./worker/containerd | ||
flags: -v | ||
skip-it: 0 | ||
typ: integration | ||
- | ||
pkg: '' | ||
flags: -v | ||
skip-it: 1 | ||
typ: integration gateway | ||
- | ||
pkg: ./frontend | ||
flags: -v | ||
skip-it: 0 | ||
typ: '' | ||
- | ||
pkg: ./frontend/dockerfile | ||
flags: -v --parallel=6 --timeout=20m | ||
skip-it: 0 | ||
typ: '' | ||
- | ||
pkg: ./frontend/dockerfile | ||
flags: -v | ||
skip-it: 0 | ||
typ: dockerfile | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Cache integration-tests | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildkit-cache/integration-tests | ||
key: ${{ runner.os }}-buildkit-integration-tests-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildkit-integration-tests- | ||
- | ||
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 ${{ matrix.pkg }} ${{ matrix.typ }} | ||
run: | | ||
./hack/test ${{ matrix.typ }} | ||
env: | ||
TEST_COVERAGE: 1 | ||
TESTPKGS: ${{ matrix.pkg }} | ||
TESTFLAGS: ${{ matrix.flags }} | ||
SKIP_INTEGRATION_TESTS: ${{ matrix.skip-it }} | ||
CACHE_DIR: /tmp/.buildkit-cache/integration-tests | ||
- | ||
name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage/coverage.txt | ||
- | ||
name: Dump context | ||
if: always() | ||
uses: crazy-max/ghaction-dump-context@v1 | ||
|
||
os: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
#- ubuntu-latest | ||
#- macOS-latest | ||
- windows-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.13 | ||
- | ||
name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- | ||
name: Go mod | ||
run: | | ||
go mod download | ||
- | ||
name: Test | ||
env: | ||
TMPDIR: ${{ runner.temp }} | ||
SKIP_INTEGRATION_TESTS: 1 | ||
run: | | ||
go test -coverprofile=coverage.txt -covermode=atomic ./... | ||
shell: bash | ||
- | ||
name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: coverage.txt | ||
- | ||
name: Dump context | ||
if: always() | ||
uses: crazy-max/ghaction-dump-context@v1 |
This file was deleted.
Oops, something went wrong.
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,4 +1,5 @@ | ||
bin | ||
coverage | ||
release-out | ||
.certs | ||
.tmp |
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
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,35 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
. $(dirname $0)/util | ||
TYP=$1 | ||
|
||
. $(dirname $0)/util | ||
set -e | ||
|
||
if [ -z "$TRAVIS_COMMIT" ]; then | ||
echo "TRAVIS_COMMIT_REQURED" | ||
exit 0 | ||
fi | ||
usage() { | ||
echo "usage: ./hack/build_ci_first_pass <typ>" | ||
exit 1 | ||
} | ||
|
||
progressFlag="" | ||
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi | ||
if [ -z "$TYP" ]; then | ||
usage | ||
fi | ||
|
||
importCacheFlags="" | ||
exportCacheFlags="" | ||
exportFlags="" | ||
|
||
if [ -f /tmp/buildkit-ci-cache-repo ]; then | ||
exportCacheFlags="--export-cache=type=inline" | ||
exportFlags="--output=type=image,push=true,name=$(cat /tmp/buildkit-ci-cache-repo)" | ||
if [ "$TRAVIS" = "true" ]; then | ||
if [ -z "$TRAVIS_COMMIT" ]; then | ||
echo "Travis commit required" | ||
exit 0 | ||
fi | ||
if [ -f /tmp/buildkit-ci-cache-repo ]; then | ||
exportCacheFlags="--cache-to=type=inline" | ||
exportFlags="--output=type=image,push=true,name=$(cat /tmp/buildkit-ci-cache-repo)" | ||
fi | ||
if [ "$TYP" = "binaries" ]; then | ||
importCacheFlags="--cache-from=type=registry,ref=cicache.buildk.it/moby/buildkit/master:binaries --cache-from=type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests" | ||
exportFlags="$exportFlags:binaries" | ||
elif [ "$TYP" = "integration-tests" ]; then | ||
importCacheFlags="--cache-from=type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests" | ||
exportFlags="$exportFlags:integration-tests" | ||
fi | ||
elif [ "$GITHUB_ACTIONS" = "true" ]; then | ||
context="." | ||
if [ -n "$cacheref" ]; then | ||
importCacheFlags="--cache-from=type=local,src=$cacheref" | ||
exportCacheFlags="--cache-to=type=local,dest=$cacheref" | ||
fi | ||
fi | ||
|
||
set -x | ||
buildctl build $progressFlag --frontend=dockerfile.v0 \ | ||
$currentcontextBuildctl \ | ||
--opt target=binaries \ | ||
--import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:binaries \ | ||
--import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests \ | ||
$exportCacheFlags $exportFlags:binaries | ||
|
||
buildctl build $progressFlag --frontend=dockerfile.v0 \ | ||
$currentcontextBuildctl \ | ||
--opt target=integration-tests-base \ | ||
--import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests \ | ||
$exportCacheFlags $exportFlags:integration-tests | ||
case $TYP in | ||
"binaries") | ||
buildxCmd build $importCacheFlags $exportCacheFlags $exportFlags \ | ||
--target "binaries" \ | ||
$currentcontext | ||
;; | ||
"integration-tests") | ||
buildxCmd build $importCacheFlags $exportCacheFlags $exportFlags \ | ||
--target "integration-tests-base" \ | ||
$currentcontext | ||
;; | ||
*) | ||
echo >&2 "Unknown type $TYP" | ||
exit 1 | ||
;; | ||
esac |
Oops, something went wrong.