Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build arm64 integration tests executable #692

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-16T15:16:19Z by kres 34e72ac.
# Generated on 2024-10-21T13:17:39Z by kres 34e72ac.

name: default
concurrency:
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
files: _out/coverage-unit-tests-client.txt,_out/coverage-unit-tests.txt
token: ${{ secrets.CODECOV_TOKEN }}
timeout-minutes: 3
- name: integration-test
- name: acompat
run: |
make integration-test
make acompat
- name: lint
run: |
make lint
Expand All @@ -118,6 +118,31 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
- name: image-acompat
run: |
make image-acompat
- name: push-acompat
if: github.event_name != 'pull_request'
env:
PUSH: "true"
run: |
make image-acompat
- name: push-acompat-latest
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
env:
PUSH: "true"
run: |
make image-acompat IMAGE_TAG=latest
- name: integration-test
run: |
make integration-test
- name: Login to registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
- name: image-integration-test
run: |
make image-integration-test
Expand Down
3 changes: 3 additions & 0 deletions .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ spec:
linux-amd64:
GOOS: linux
GOARCH: amd64
linux-arm64:
GOOS: linux
GOARCH: arm64
---
kind: golang.Generate
spec:
Expand Down
47 changes: 46 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-15T13:33:30Z by kres 34e72ac.
# Generated on 2024-10-21T13:17:39Z by kres 34e72ac.

ARG JS_TOOLCHAIN
ARG TOOLCHAIN
Expand Down Expand Up @@ -322,6 +322,18 @@ COPY --from=unit-tests-client-run /src/client/coverage.txt /coverage-unit-tests-
FROM scratch AS unit-tests
COPY --from=unit-tests-run /src/coverage.txt /coverage-unit-tests.txt

# builds acompat-linux-amd64
FROM base AS acompat-linux-amd64-build
COPY --from=generate / /
COPY --from=embed-generate / /
WORKDIR /src/cmd/acompat
ARG GO_BUILDFLAGS
ARG GO_LDFLAGS
ARG VERSION_PKG="internal/version"
ARG SHA
ARG TAG
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS} -X ${VERSION_PKG}.Name=acompat -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /acompat-linux-amd64

# builds integration-test-linux-amd64
FROM base AS integration-test-linux-amd64-build
COPY --from=generate / /
Expand All @@ -334,6 +346,18 @@ ARG SHA
ARG TAG
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS} -X ${VERSION_PKG}.Name=integration-test -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /integration-test-linux-amd64

# builds integration-test-linux-arm64
FROM base AS integration-test-linux-arm64-build
COPY --from=generate / /
COPY --from=embed-generate / /
WORKDIR /src/cmd/integration-test
ARG GO_BUILDFLAGS
ARG GO_LDFLAGS
ARG VERSION_PKG="internal/version"
ARG SHA
ARG TAG
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS} -X ${VERSION_PKG}.Name=integration-test -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /integration-test-linux-arm64

# builds omni-darwin-amd64
FROM base AS omni-darwin-amd64-build
COPY --from=generate / /
Expand Down Expand Up @@ -442,9 +466,15 @@ ARG SHA
ARG TAG
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=windows go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS} -X ${VERSION_PKG}.Name=omnictl -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /omnictl-windows-amd64.exe

FROM scratch AS acompat-linux-amd64
COPY --from=acompat-linux-amd64-build /acompat-linux-amd64 /acompat-linux-amd64

FROM scratch AS integration-test-linux-amd64
COPY --from=integration-test-linux-amd64-build /integration-test-linux-amd64 /integration-test-linux-amd64

FROM scratch AS integration-test-linux-arm64
COPY --from=integration-test-linux-arm64-build /integration-test-linux-arm64 /integration-test-linux-arm64

FROM scratch AS omni-darwin-amd64
COPY --from=omni-darwin-amd64-build /omni-darwin-amd64 /omni-darwin-amd64

Expand Down Expand Up @@ -472,10 +502,16 @@ COPY --from=omnictl-linux-arm64-build /omnictl-linux-arm64 /omnictl-linux-arm64
FROM scratch AS omnictl-windows-amd64.exe
COPY --from=omnictl-windows-amd64.exe-build /omnictl-windows-amd64.exe /omnictl-windows-amd64.exe

FROM acompat-linux-${TARGETARCH} AS acompat

FROM scratch AS acompat-all
COPY --from=acompat-linux-amd64 / /

FROM integration-test-linux-${TARGETARCH} AS integration-test

FROM scratch AS integration-test-all
COPY --from=integration-test-linux-amd64 / /
COPY --from=integration-test-linux-arm64 / /

FROM omni-linux-${TARGETARCH} AS omni

Expand All @@ -494,6 +530,15 @@ COPY --from=omnictl-linux-amd64 / /
COPY --from=omnictl-linux-arm64 / /
COPY --from=omnictl-windows-amd64.exe / /

FROM scratch AS image-acompat
ARG TARGETARCH
COPY --from=acompat acompat-linux-${TARGETARCH} /acompat
COPY --from=acompat acompat-linux-${TARGETARCH} /acompat
COPY --from=image-fhs / /
COPY --from=image-ca-certificates / /
LABEL org.opencontainers.image.source=https://github.com/siderolabs/omni
ENTRYPOINT ["/acompat"]

FROM scratch AS image-integration-test
ARG TARGETARCH
COPY --from=integration-test integration-test-linux-${TARGETARCH} /integration-test
Expand Down
39 changes: 30 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-16T15:16:19Z by kres 34e72ac.
# Generated on 2024-10-21T13:17:39Z by kres 34e72ac.

# common variables

Expand Down Expand Up @@ -141,7 +141,7 @@ else
GO_LDFLAGS += -s
endif

all: unit-tests-frontend lint-eslint frontend unit-tests-client unit-tests integration-test image-integration-test omni image-omni omnictl dev-server docker-compose-up docker-compose-down mkcert-install mkcert-generate mkcert-uninstall run-integration-test lint
all: unit-tests-frontend lint-eslint frontend unit-tests-client unit-tests acompat image-acompat integration-test image-integration-test omni image-omni omnictl dev-server docker-compose-up docker-compose-down mkcert-install mkcert-generate mkcert-uninstall run-integration-test lint

$(ARTIFACTS): ## Creates artifacts directory.
@mkdir -p $(ARTIFACTS)
Expand Down Expand Up @@ -226,15 +226,15 @@ unit-tests: ## Performs unit tests
unit-tests-race: ## Performs unit tests with race detection enabled.
@$(MAKE) target-$@

.PHONY: $(ARTIFACTS)/integration-test-linux-amd64
$(ARTIFACTS)/integration-test-linux-amd64:
@$(MAKE) local-integration-test-linux-amd64 DEST=$(ARTIFACTS)
.PHONY: $(ARTIFACTS)/acompat-linux-amd64
$(ARTIFACTS)/acompat-linux-amd64:
@$(MAKE) local-acompat-linux-amd64 DEST=$(ARTIFACTS)

.PHONY: integration-test-linux-amd64
integration-test-linux-amd64: $(ARTIFACTS)/integration-test-linux-amd64 ## Builds executable for integration-test-linux-amd64.
.PHONY: acompat-linux-amd64
acompat-linux-amd64: $(ARTIFACTS)/acompat-linux-amd64 ## Builds executable for acompat-linux-amd64.

.PHONY: integration-test
integration-test: integration-test-linux-amd64 ## Builds executables for integration-test.
.PHONY: acompat
acompat: acompat-linux-amd64 ## Builds executables for acompat.

.PHONY: lint-markdown
lint-markdown: ## Runs markdownlint.
Expand All @@ -243,6 +243,27 @@ lint-markdown: ## Runs markdownlint.
.PHONY: lint
lint: lint-eslint lint-golangci-lint-client lint-gofumpt-client lint-govulncheck-client lint-golangci-lint lint-gofumpt lint-govulncheck lint-markdown ## Run all linters for the project.

.PHONY: image-acompat
image-acompat: ## Builds image for acompat.
@$(MAKE) target-$@ TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/acompat:$(IMAGE_TAG)"

.PHONY: $(ARTIFACTS)/integration-test-linux-amd64
$(ARTIFACTS)/integration-test-linux-amd64:
@$(MAKE) local-integration-test-linux-amd64 DEST=$(ARTIFACTS)

.PHONY: integration-test-linux-amd64
integration-test-linux-amd64: $(ARTIFACTS)/integration-test-linux-amd64 ## Builds executable for integration-test-linux-amd64.

.PHONY: $(ARTIFACTS)/integration-test-linux-arm64
$(ARTIFACTS)/integration-test-linux-arm64:
@$(MAKE) local-integration-test-linux-arm64 DEST=$(ARTIFACTS)

.PHONY: integration-test-linux-arm64
integration-test-linux-arm64: $(ARTIFACTS)/integration-test-linux-arm64 ## Builds executable for integration-test-linux-arm64.

.PHONY: integration-test
integration-test: integration-test-linux-amd64 integration-test-linux-arm64 ## Builds executables for integration-test.

.PHONY: image-integration-test
image-integration-test: ## Builds image for omni-integration-test.
@$(MAKE) target-$@ TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/omni-integration-test:$(IMAGE_TAG)"
Expand Down