Skip to content

Commit

Permalink
CircleCI构建修复 (#290)
Browse files Browse the repository at this point in the history
* ARM

* ARM

* ARM

* ARM

* Revert "ARM"

This reverts commit 5777ccf

* ARM

* ARM

* CircleCI 构建触发条件bug修复测试

* CircleCI 构建参数bug修复测试

* #1 go 1.19.13 updated 1.19.17
#2 workflows recovery unit-test
#3 适配pauseTarFile := filepath.Join(dir, "build/pause/pause.tar") pause-arm64 and pause-amd64

* #1 go 1.19.13 updated 1.19.17
#2 workflows recovery unit-test
#3 适配pauseTarFile := filepath.Join(dir, "build/pause/pause.tar") pause-arm64 and pause-amd64
  • Loading branch information
wangzul authored Apr 26, 2024
1 parent 7e82517 commit 89e5b94
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 6 deletions.
51 changes: 47 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,34 @@ executors:
shell: /bin/bash --login -eo pipefail

commands:
test:
steps:
- checkout
- setup_remote_docker
- run:
name: "install go"
command: |
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64";;
aarch64) ARCH="arm64";;
*) echo "Unsupported architecture"; exit 1;;
esac
GOLANG_DIR="/usr/local"
GOLANG_VERSION="1.19.17"
GOLANG_URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz"
if ! command -v go &> /dev/null; then
wget "$GOLANG_URL"
tar -C "$GOLANG_DIR" -xzf "go${GOLANG_VERSION}.linux-${ARCH}.tar.gz"
echo 'export PATH=$PATH:/usr/local/go/bin' | tee -a ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV
source ~/.bashrc
fi
- run:
name: Test Kuscia
command: make test
build_kuscia:
steps:
- setup_remote_docker
Expand All @@ -51,7 +79,7 @@ commands:
esac
GOLANG_DIR="/usr/local"
GOLANG_VERSION="1.22.2"
GOLANG_VERSION="1.19.17"
GOLANG_URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz"
if ! command -v go &> /dev/null; then
Expand All @@ -71,6 +99,14 @@ commands:
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs:
unit-test:
parameters:
executor:
type: string
executor: <<parameters.executor>>
steps:
- checkout
- test
linux_build_kuscia:
parameters:
executor:
Expand Down Expand Up @@ -113,11 +149,18 @@ jobs:
# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows:
unit-test:
jobs:
- unit-test:
matrix:
parameters:
executor: [ "linux_x64_executor", "linux_aarch64_executor" ]
build-workflow:
when:
or:
- equal: [ "publish_kuscia_deps", << pipeline.parameters.GHA_Meta >> ]
- equal: [ "publish_pypi", << pipeline.parameters.GHA_Meta >> ]
not:
or:
- equal: [ "publish_kuscia_deps", << pipeline.parameters.GHA_Meta >> ]
- equal: [ "publish_pypi", << pipeline.parameters.GHA_Meta >> ]
jobs:
- linux_build_kuscia:
matrix:
Expand Down
12 changes: 12 additions & 0 deletions .circleci/deps-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
version: 2.1

parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""
DEPS_Tag:
type: string
default: ""
Expand Down
12 changes: 10 additions & 2 deletions pkg/agent/local/store/ieport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,22 @@ func TestStore_RegisterImage(t *testing.T) {
}

func TestStore_LoadImage(t *testing.T) {
arch := runtime.GOARCH
_, filename, _, ok := runtime.Caller(0)
assert.True(t, ok)
dir := filepath.Dir(filename)
for i := 0; i < 4; i++ {
dir = filepath.Dir(dir)
}
pauseTarFile := filepath.Join(dir, "build/pause/pause.tar")

var pauseTarFile string
switch arch {
case "aarch64", "arm64":
pauseTarFile = filepath.Join(dir, "build/pause/pause-arm64.tar")
case "amd64", "x86_64":
pauseTarFile = filepath.Join(dir, "build/pause/pause-amd64.tar")
default:
pauseTarFile = filepath.Join(dir, "build/pause/pause-amd64.tar")
}
file, err := os.Open(pauseTarFile)
assert.NoError(t, err)
defer file.Close()
Expand Down

0 comments on commit 89e5b94

Please sign in to comment.