Skip to content

Commit

Permalink
xx-macports: add tests
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Feb 16, 2024
1 parent 90cf4fb commit b0c2be3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ group "test" {
"test-verify",
"test-clang",
"test-go",
"test-cargo"
"test-cargo",
"test-macports"
]
}

Expand Down Expand Up @@ -97,6 +98,11 @@ target "test-cargo" {
target = "test-cargo"
}

target "test-macports" {
inherits = ["test-base"]
target = "test-macports"
}

group "validate" {
targets = ["shfmt-validate", "shellcheck"]
}
Expand Down
6 changes: 6 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ COPY --from=build /out/ /usr/bin/

FROM --platform=$BUILDPLATFORM tonistiigi/bats-assert AS bats-assert

# osxcross for usage with macports: https://github.com/tpoechtrager/osxcross/blob/master/README.MACPORTS.md
FROM --platform=$BUILDPLATFORM crazymax/osxcross:13.1 AS osxcross

FROM ${TEST_BASE_IMAGE} AS test-base-alpine
RUN --mount=type=cache,target=/pkg-cache \
ln -s /pkg-cache /etc/apk/cache && \
Expand Down Expand Up @@ -92,6 +95,9 @@ FROM test-base-fixtures AS test-cargo
COPY test-cargo.bats test_helper.bash ./
RUN --mount=type=cache,target=/pkg-cache,sharing=locked ./test-cargo.bats

FROM test-base AS test-macports
COPY test-macports.bats test_helper.bash ./
RUN --mount=type=cache,target=/pkg-cache,sharing=locked --mount=from=osxcross,source=/osxcross,target=/osxcross ./test-macports.bats

# these targets can be overwritten with build contexts
FROM scratch AS sdk-extras
Expand Down
10 changes: 10 additions & 0 deletions src/test-macports.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bats

load 'assert'
load 'test_helper'

@test "install" {
run xx-macports --static install jq
assert_success
assert_output --partial "installed jq"
}

0 comments on commit b0c2be3

Please sign in to comment.