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

chore: add workflow for chao-os. #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
47 changes: 47 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under 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 KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


name: CI

on: [push, pull_request]

jobs:
build:
name: ${{ matrix.os }} - CI - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.15
- 1.16
- 1.17
os:
- ubuntu-latest
steps:
- name: Set Up Go ${{ matrix.go_version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Checkout
id: checkout
uses: actions/checkout@v2
- name: Tests
Copy link
Member

Choose a reason for hiding this comment

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

可以增加一些前置:
go get -v -t -d ./...
diff -u <(echo -n) <(gofmt -d -s .)
diff -u <(echo -n) <(goimports -d .)

id: test
run: |
make test
6 changes: 3 additions & 3 deletions exec/file/file_append.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ func parseRandom(content string) *spec.Response {
split := strings.Split(text[1], "-")
begin, err := strconv.Atoi(split[0])
if err != nil {
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("%s illegal parameter", begin))
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("%d illegal parameter", begin))
}

end, err := strconv.Atoi(split[1])
if err != nil {
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("%s illegal parameter", end))
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("%d illegal parameter", end))
}

if end <= begin {
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("run append file %s failed, begin must < end"))
return spec.ReturnFail(spec.ParameterIllegal, fmt.Sprintf("run append file %d, failed, begin must < end", end))
}
content = strings.Replace(content, text[0], strconv.Itoa(rand.Intn(end-begin)+begin), 1)
}
Expand Down
2 changes: 1 addition & 1 deletion exec/mem/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func burnMemWithCache(ctx context.Context, memPercent, memReserve, memRate int,
func (ce *memExecutor) start(ctx context.Context, memPercent, memReserve, memRate int, burnMemMode string, includeBufferCache bool, avoidBeingKilled bool, cl spec.Channel) {
// adjust process oom_score_adj to avoid being killed
if avoidBeingKilled {
scoreAdjFile := fmt.Sprintf(processOOMAdj, os.Getpid())
scoreAdjFile := fmt.Sprintf(processOOMAdj, strconv.Itoa(os.Getpid()))
Copy link
Contributor

Choose a reason for hiding this comment

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

processOOMAdj = "/proc/%d/oom_adj", so need not strconv

if _, err := os.Stat(scoreAdjFile); os.IsExist(err) {
if err := ioutil.WriteFile(scoreAdjFile, []byte(oomMinAdj), 0644); err != nil {
log.Errorf(ctx, "run burn memory by %s mode failed, cannot edit the process oom_score_adj", burnMemMode)
Expand Down