Merge pull request #43474 from crazy-max/fix-cross
fix cross compilation for arm platforms
This commit is contained in:
commit
61404de7df
3 changed files with 84 additions and 7 deletions
62
.github/workflows/ci.yml
vendored
62
.github/workflows/ci.yml
vendored
|
@ -40,12 +40,62 @@ jobs:
|
||||||
*.cache-from=type=gha,scope=build-${{ matrix.target }}
|
*.cache-from=type=gha,scope=build-${{ matrix.target }}
|
||||||
*.cache-to=type=gha,scope=build-${{ matrix.target }}
|
*.cache-to=type=gha,scope=build-${{ matrix.target }}
|
||||||
-
|
-
|
||||||
name: Upload build artifacts
|
name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.target }}
|
name: ${{ matrix.target }}
|
||||||
path: ${{ env.BUNDLES_OUTPUT }}/${{ matrix.target }}-daemon/*
|
path: ${{ env.BUNDLES_OUTPUT }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
cross:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm/v5
|
||||||
|
- linux/arm/v6
|
||||||
|
- linux/arm/v7
|
||||||
|
- linux/arm64
|
||||||
|
- linux/ppc64le
|
||||||
|
- linux/s390x
|
||||||
|
- windows/amd64
|
||||||
|
- windows/arm64
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Prepare
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
mkdir -p autogen
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: docker/bake-action@v1
|
||||||
|
with:
|
||||||
|
targets: cross
|
||||||
|
set: |
|
||||||
|
*.cache-from=type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
|
||||||
|
*.cache-to=type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
|
||||||
|
env:
|
||||||
|
DOCKER_CROSSPLATFORMS: ${{ matrix.platform }}
|
||||||
|
-
|
||||||
|
name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: cross-${{ env.PLATFORM_PAIR }}
|
||||||
|
path: ${{ env.BUNDLES_OUTPUT }}
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
test-buildkit:
|
test-buildkit:
|
||||||
needs:
|
needs:
|
||||||
|
@ -91,8 +141,8 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
-
|
||||||
name: Download build artifacts
|
name: Download binary artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: binary
|
name: binary
|
||||||
path: ./buildkit/build/moby/
|
path: ./buildkit/build/moby/
|
||||||
|
@ -110,7 +160,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
CONTEXT: "."
|
CONTEXT: "."
|
||||||
TEST_DOCKERD: "1"
|
TEST_DOCKERD: "1"
|
||||||
TEST_DOCKERD_BINARY: "./build/moby/dockerd"
|
TEST_DOCKERD_BINARY: "./build/moby/binary-daemon/dockerd"
|
||||||
TESTPKGS: "${{ matrix.pkg }}"
|
TESTPKGS: "${{ matrix.pkg }}"
|
||||||
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
|
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
|
||||||
SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}"
|
SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}"
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
variable "BUNDLES_OUTPUT" {
|
variable "BUNDLES_OUTPUT" {
|
||||||
default = "./bundles"
|
default = "./bundles"
|
||||||
}
|
}
|
||||||
|
variable "DOCKER_CROSSPLATFORMS" {
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
target "_common" {
|
target "_common" {
|
||||||
args = {
|
args = {
|
||||||
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
||||||
|
APT_MIRROR = "cdn-fastly.deb.debian.org"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,3 +26,12 @@ target "dynbinary" {
|
||||||
inherits = ["binary"]
|
inherits = ["binary"]
|
||||||
target = "dynbinary"
|
target = "dynbinary"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "cross" {
|
||||||
|
inherits = ["binary"]
|
||||||
|
args = {
|
||||||
|
CROSS = "true"
|
||||||
|
DOCKER_CROSSPLATFORMS = DOCKER_CROSSPLATFORMS
|
||||||
|
}
|
||||||
|
target = "cross"
|
||||||
|
}
|
||||||
|
|
|
@ -47,11 +47,25 @@ hash_files() {
|
||||||
;;
|
;;
|
||||||
linux/arm)
|
linux/arm)
|
||||||
case "${GOARM}" in
|
case "${GOARM}" in
|
||||||
5 | "")
|
5)
|
||||||
export CC="${CC:-arm-linux-gnueabi-gcc}"
|
export CC="${CC:-arm-linux-gnueabi-gcc}"
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
|
export CGO_CFLAGS="-march=armv5t"
|
||||||
|
export CGO_CXXFLAGS="-march=armv5t"
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
export CC="${CC:-arm-linux-gnueabi-gcc}"
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export CGO_CFLAGS="-march=armv6"
|
||||||
|
export CGO_CXXFLAGS="-march=armv6"
|
||||||
;;
|
;;
|
||||||
7)
|
7)
|
||||||
|
export CC="${CC:-arm-linux-gnueabihf-gcc}"
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export CGO_CFLAGS="-march=armv7-a"
|
||||||
|
export CGO_CXXFLAGS="-march=armv7-a"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
export CC="${CC:-arm-linux-gnueabihf-gcc}"
|
export CC="${CC:-arm-linux-gnueabihf-gcc}"
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue