Skip to content

Commit

Permalink
add loongarch64 support
Browse files Browse the repository at this point in the history
Signed-off-by: yzewei <[email protected]>
  • Loading branch information
yzewei committed Jan 18, 2024
1 parent 8db003e commit a5e8834
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 209 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ jobs:
fail-fast: false
matrix:
include:
-
image: alpine:3.13
typ: alpine
allow-failure: false
-
image: alpine:3.14
typ: alpine
allow-failure: false
-
image: alpine:3.15
typ: alpine
Expand All @@ -59,6 +51,10 @@ jobs:
image: alpine:3.18
typ: alpine
allow-failure: false
-
image: alpine:3.19
typ: alpine
allow-failure: false
-
image: alpine:edge
typ: alpine
Expand All @@ -75,6 +71,14 @@ jobs:
image: debian:bookworm
typ: debian
allow-failure: false
-
image: debian:bookworm-backports
typ: debian
allow-failure: false
-
image: debian:trixie
typ: debian
allow-failure: false
-
image: debian:sid
typ: debian
Expand All @@ -87,6 +91,14 @@ jobs:
image: ubuntu:22.04
typ: debian
allow-failure: false
-
image: ubuntu:23.04
typ: debian
allow-failure: false
-
image: ubuntu:24.04
typ: debian
allow-failure: false
-
image: redhat/ubi8
typ: rhel
Expand All @@ -99,6 +111,10 @@ jobs:
image: fedora:38
typ: rhel
allow-failure: false
-
image: fedora:39
typ: rhel
allow-failure: false
-
image: centos:7
typ: rhel
Expand Down
79 changes: 50 additions & 29 deletions .github/workflows/ld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,8 @@ jobs:
*.cache-from=type=gha,scope=${{ matrix.target }}
*.cache-to=type=gha,scope=${{ matrix.target }}
ld64-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create targets matrix
id: targets
run: |
matrix=$(docker buildx bake ld64-static-tgz --print | jq -cr '.group."ld64-static-tgz".targets')
echo "matrix=${matrix}" >> ${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.targets.outputs.matrix }}
ld64:
runs-on: ubuntu-latest
needs:
- ld64-targets
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.ld64-targets.outputs.matrix) }}
steps:
-
name: Checkout
Expand All @@ -120,11 +95,11 @@ jobs:
name: Build
uses: docker/bake-action@v2
with:
targets: ${{ matrix.target }}
targets: ld64-static-tgz
set: |
*.cache-from=type=gha,scope=${{ matrix.target }}
*.cache-to=type=gha,scope=${{ matrix.target }}
*.output=type=local,dest=./dist,platform-split=false
ld64-static-tgz.cache-from=type=gha,scope=ld64-static-tgz
ld64-static-tgz.cache-to=type=gha,scope=ld64-static-tgz
ld64-static-tgz.output=type=local,dest=./dist,platform-split=false
-
name: List artifacts
run: |
Expand Down Expand Up @@ -201,6 +176,52 @@ jobs:
if-no-files-found: error
retention-days: 1

utils-lipo:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
-
name: Build
uses: docker/bake-action@v2
with:
targets: lipo
set: |
lipo.cache-from=type=gha,scope=lipo
lipo.cache-to=type=gha,scope=lipo
utils-sigtool:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
-
name: Build
uses: docker/bake-action@v2
with:
targets: sigtool
set: |
sigtool.cache-from=type=gha,scope=sigtool
sigtool.cache-to=type=gha,scope=sigtool
release:
runs-on: ubuntu-latest
if: ${{ inputs.release }}
Expand Down
60 changes: 40 additions & 20 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ variable "DEV_SDK_PLATFORM" {
default = null
}

variable "DEV_WITH_LD64" {}

// Special target: https://github.com/docker/metadata-action#bake-definition
target "meta-helper" {
tags = ["${XX_REPO}:test"]
Expand Down Expand Up @@ -135,7 +137,8 @@ target "_all-platforms" {
"linux/mips64le",
"linux/ppc64le",
"linux/s390x",
"linux/riscv64"
"linux/riscv64",
"linux/loong64"
]
}

Expand Down Expand Up @@ -169,6 +172,7 @@ target "sdk-extras" {
"linux/mips64le",
"linux/ppc64le",
"linux/riscv64",
"linux/loong64",
"linux/s390x",
"windows/386",
"windows/amd64",
Expand Down Expand Up @@ -236,32 +240,21 @@ target "binutils" {
tags = binutilsTag(XX_REPO, BINUTILS_VERSION, BINUTILS_VERSION_ONLY, tgt)
}

target "ld64-static-tgz" {
name = "ld64-${tgt}-static-tgz"
target "ld64" {
inherits = ["_ld-base"]
matrix = {
tgt = [
"linux-386",
"linux-amd64",
"linux-arm64",
"linux-armv6",
"linux-armv7"
]
}
target = "ld64-static-tgz"
args = {
LD_TARGET = tgt
}
target = "ld64-signed-static"
}

target "ld64-static-tgz" {
inherits = ["ld64"]
platforms = [
"linux/386",
"linux/amd64",
"linux/arm64",
"linux/arm/v6",
"linux/arm/v7"
"linux/arm/v7",
]
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", tgt)[0]])]
cache-to = ["type=inline"]
output = ["./bin/ld-static-tgz"]
target = "ld64-static-tgz"
}

target "ld-static-tgz" {
Expand Down Expand Up @@ -330,6 +323,7 @@ target "dev" {
contexts = {
"tonistiigi/xx" = "target:xx"
"sdk-extras" = DEV_SDK_PLATFORM != null ? "target:sdk-extras-dev" : "docker-image://scratch"
"ld64" = DEV_WITH_LD64 != "" ? "target:ld64" : "docker-image://scratch"
}
args = {
TEST_BASE_TYPE = TEST_BASE_TYPE
Expand All @@ -339,4 +333,30 @@ target "dev" {
output = [
"type=docker"
]
}

target "lipo" {
context = "src/ld"
target = "lipo-static"
contexts = {
"tonistiigi/xx" = "target:xx"
}
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
]
}

target "sigtool" {
context = "src/ld"
target = "sigtool-static"
contexts = {
"tonistiigi/xx" = "target:xx"
}
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
]
}
3 changes: 3 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ COPY test-cargo.bats test_helper.bash ./
RUN --mount=type=cache,target=/pkg-cache,sharing=locked ./test-cargo.bats


# these targets can be overwritten with build contexts
FROM scratch AS sdk-extras
FROM scratch AS ld64

# dev can be used for debugging during development
FROM test-base AS dev
COPY --link --from=sdk-extras / /
COPY --link --from=ld64 / /usr/bin/
COPY --link --from=xx / /
COPY fixtures fixtures
COPY *.bats test_helper.bash ./
Expand Down
Loading

0 comments on commit a5e8834

Please sign in to comment.