Skip to content
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
54 changes: 40 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -17,16 +17,14 @@
#

name: Build

on:
pull_request:
push:
branches:
- main

jobs:
build:
name: Build
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
Expand All @@ -36,23 +34,51 @@ jobs:
cache-dependency-path: |
go.sum
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Check License
uses: apache/skywalking-eyes@ec88b7d850018c8983f87729ea88549e100c5c82
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint Codes
run: make lint

- name: Test
run: make test

run: CGO_ENABLED=1 make test
build-platform:
name: Build (${{ matrix.os }})
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
- os: macos-latest
target: darwin
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26
cache-dependency-path: |
go.sum
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Build
run: make build

run: make ${{ matrix.target }}
- name: Build Docker Image
if: matrix.os == 'ubuntu-latest'
run: make docker
build:
name: Build
runs-on: ubuntu-latest
needs:
- lint-and-test
- build-platform
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Result
run: echo "Lint and Test, Build (ubuntu-latest), Build (windows-latest), Build (macos-latest) completed successfully!"
11 changes: 1 addition & 10 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,7 @@ jobs:
uses: actions/checkout@v4

- name: Build e2e
run: make linux

- name: Install docker-compose
shell: bash
run: |
if ! command docker-compose 2>&1 > /dev/null; then
echo "Installing docker-compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
run: CGO_ENABLED=1 make linux

- name: Run E2E Test
uses: apache/skywalking-infra-e2e@main
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -22,7 +22,10 @@ WORKDIR /e2e

COPY . .

RUN make linux
# Install build dependencies for CGO
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*

RUN CGO_ENABLED=1 make linux

FROM golang:1.26 AS bin

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ GO := GO111MODULE=on go
GO_PATH = $(shell $(GO) env GOPATH)
GOARCH ?= $(shell $(GO) env GOARCH)
GOOS ?= $(shell $(GO) env GOOS)
HOST_GOOS = $(shell $(GO) env GOOS)
HOST_GOARCH = $(shell $(GO) env GOARCH)
# CGO is enabled only for native builds; cross-compilation requires target SDK
CGO_FLAG = $(shell if [ "$(os)" = "$(HOST_GOOS)" ] && [ "$(GOARCH)" = "$(HOST_GOARCH)" ]; then echo 1; else echo 0; fi)
GO_BUILD = $(GO) build
GO_TEST = $(GO) test
GO_LINT = $(GO_PATH)/bin/golangci-lint
Expand Down Expand Up @@ -57,7 +61,7 @@ windows: PROJECT_SUFFIX=.exe
.PHONY: $(PLATFORMS)
$(PLATFORMS):
mkdir -p $(OUT_DIR)
GOOS=$(os) GOARCH=$(GOARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(os)/$(PROJECT)$(PROJECT_SUFFIX) cmd/e2e/main.go
GOOS=$(os) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_FLAG) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(os)/$(PROJECT)$(PROJECT_SUFFIX) cmd/e2e/main.go

.PHONY: build
build: windows linux darwin
Expand Down
27 changes: 3 additions & 24 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,14 @@ inputs:
runs:
using: "composite"
steps:
- name: Disable containerd image store
- name: Set Docker API version
shell: bash
run: |
DAEMON_JSON="/etc/docker/daemon.json"
if [ -f "$DAEMON_JSON" ]; then
sudo jq '. + {"features": {"containerd-snapshotter": false}}' "$DAEMON_JSON" \
| sudo tee "${DAEMON_JSON}.tmp" > /dev/null
sudo mv "${DAEMON_JSON}.tmp" "$DAEMON_JSON"
else
echo '{"features": {"containerd-snapshotter": false}}' \
| sudo tee "$DAEMON_JSON" > /dev/null
fi
sudo systemctl restart docker
docker version
docker info
echo "DOCKER_API_VERSION=$(docker version --format '{{.Server.APIVersion}}')" >> "$GITHUB_ENV"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this now? This entire step was added to work around the issue, I think the entire step Set Docker API version can be removed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we still need this line to keep client version following the server declared.

- name: Install docker-compose
shell: bash
if: runner.os != 'Windows'
run: |
if ! command docker-compose 2>&1 > /dev/null; then
echo "Installing docker-compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.24
go-version: 1.26
cache-dependency-path: ${{ github.action_path }}/go.sum
- shell: bash
run: make -C $GITHUB_ACTION_PATH install DESTDIR=/usr/local/bin
Expand Down
Loading
Loading