Skip to content

Commit

Permalink
change CI
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Aug 2, 2023
1 parent 9d5b284 commit 48187b5
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 73 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/benchmark-linux-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ jobs:

- uses: actions/checkout@v2

- name: Check Branch
run: ./check_branch_name.sh ${{ github.head_ref }}

- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -27,4 +24,4 @@ jobs:
${{ runner.os }}-go-
- name: Benchmark sonic
run: sh bench-arm.sh
run: sh scripts/bench-arm.sh
5 changes: 1 addition & 4 deletions .github/workflows/benchmark-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ jobs:

- uses: actions/checkout@v2

- name: Check Branch
run: ./check_branch_name.sh ${{ github.head_ref }}

- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -27,4 +24,4 @@ jobs:
${{ runner.os }}-go-
- name: Benchmark sonic
run: sh bench.sh
run: sh scripts/bench.sh
16 changes: 7 additions & 9 deletions .github/workflows/compatibility_test-windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push Check Linux-ARM
name: Push Check Windows-X64

on: pull_request

Expand All @@ -7,12 +7,8 @@ jobs:
strategy:
matrix:
go-version: [1.17.x, 1.20.x]
os: [windows-latest]
runs-on: ${{ matrix.os }}
runs-on: windows-latest
steps:
- name: Clear repository
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

- uses: actions/checkout@v2

- name: Set up Go
Expand All @@ -28,12 +24,14 @@ jobs:
${{ runner.os }}-go-
- name: main
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic
run: |
go test -v -race github.com/bytedance/sonic
- name: ast
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast
run: |
go test -v -race github.com/bytedance/sonic/ast
- name: external
run: |
cd ./external_jsonlib_test
GOMAXPROCS=4 go test -v -race ./...
go test -v -race ./...
14 changes: 2 additions & 12 deletions .github/workflows/compatibility_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ jobs:

- name: ast
run: GOMAXPROCS=4 go test -v -race github.com/bytedance/sonic/ast

- name: external
run: |
cd ./external_jsonlib_test
GOMAXPROCS=4 go test -v -race ./...

# - name: qemu
# run: |
# printf ' #!/bin/bash\n if [ ! -x "/usr/bin/qemu-x86_64" ];then\n sudo apt-get update\n sudo apt-get -y install make gcc g++ libglib2.0-dev libpixman-1-dev libfdt-dev python3-pip ninja-build\n sudo pip3 install meson\n wget https://download.qemu.org/qemu-6.2.0.tar.xz\n tar -xvf qemu-6.2.0.tar.xz\n cd qemu-6.2.0\n sudo ./configure\n sudo make -j 4\n sudo make install\n cd ..\n cp /usr/local/bin/qemu-x86_64 /usr/bin/qemu-x86_64\n fi\n' > qemu_install.sh
# chmod +x qemu_install.sh
# ./qemu_install.sh
# GOARCH=amd64 go test -c .
# qemu-x86_64 -cpu max ./sonic.test -test.v
- name: qemu
run: sh scripts/qemu.sh
3 changes: 3 additions & 0 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ jobs:
uses: apache/skywalking-eyes/header@v0.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check Branch
run: ./scripts/check_branch_name.sh ${{ github.head_ref }}
5 changes: 5 additions & 0 deletions .github/workflows/unit_test-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ jobs:
run: |
go test -race -covermode=atomic -coverprofile=coverage.txt ./...
- name: external
run: |
cd ./external_jsonlib_test
GOMAXPROCS=4 go test -v -race ./...
- name: Codecov
run: bash <(curl -s https://codecov.io/bash)
26 changes: 2 additions & 24 deletions decoder/decoder_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,35 +169,13 @@ func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
return nil
}

type StreamDecoder struct {
r io.Reader
buf []byte
scanp int
scanned int64
err error
Decoder
}
type StreamDecoder = json.Decoder

// NewStreamDecoder adapts to encoding/json.NewDecoder API.
//
// NewStreamDecoder returns a new decoder that reads from r.
func NewStreamDecoder(r io.Reader) *StreamDecoder {
return &StreamDecoder{r : r}
}

// Decode decodes input stream into val with corresponding data.
// Redundantly bytes may be read and left in its buffer, and can be used at next call.
// Either io error from underlying io.Reader (except io.EOF)
// or syntax error from data will be recorded and stop subsequently decoding.
func (self *StreamDecoder) Decode(val interface{}) (err error) {
dec := json.NewDecoder(self.r)
if (self.f | uint64(OptionUseNumber)) != 0 {
dec.UseNumber()
}
if (self.f | uint64(OptionDisableUnknown)) != 0 {
dec.DisallowUnknownFields()
}
return dec.Decode(val)
return json.NewDecoder(r)
}

// SyntaxError represents json syntax error
Expand Down
15 changes: 2 additions & 13 deletions encoder/encoder_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,23 +216,12 @@ func Valid(data []byte) (ok bool, start int) {
}

// StreamEncoder uses io.Writer as
type StreamEncoder struct {
w io.Writer
Encoder
}
type StreamEncoder = json.Encoder

// NewStreamEncoder adapts to encoding/json.NewDecoder API.
//
// NewStreamEncoder returns a new encoder that write to w.
func NewStreamEncoder(w io.Writer) *StreamEncoder {
return &StreamEncoder{w: w}
return json.NewEncoder(w)
}

// Encode encodes interface{} as JSON to io.Writer
func (enc *StreamEncoder) Encode(val interface{}) (err error) {
jenc := json.NewEncoder(enc.w)
jenc.SetEscapeHTML((enc.Opts & EscapeHTML) != 0)
jenc.SetIndent(enc.prefix, enc.indent)
err = jenc.Encode(val)
return err
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 9 additions & 7 deletions scripts/qemu.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
if []
printf ' #!/bin/bash\n if [ ! -x "/usr/bin/qemu-x86_64" ];then\n sudo apt-get update\n sudo apt-get -y install make gcc g++ libglib2.0-dev libpixman-1-dev libfdt-dev python3-pip ninja-build\n sudo pip3 install meson\n wget https://download.qemu.org/qemu-6.2.0.tar.xz\n tar -xvf qemu-6.2.0.tar.xz\n cd qemu-6.2.0\n sudo ./configure\n sudo make -j 4\n sudo make install\n cd ..\n cp /usr/local/bin/qemu-x86_64 /usr/bin/qemu-x86_64\n fi\n' > qemu_install.sh
chmod +x qemu_install.sh
./qemu_install.sh
GOARCH=amd64 go test -c .
qemu-x86_64 -cpu max ./sonic.test -test.v
#!/bin/sh
arch=$(uname -m)
if echo $arch | grep -q 'arm'; then
printf ' #!/bin/bash\n if [ ! -x "/usr/bin/qemu-x86_64" ];then\n sudo apt-get update\n sudo apt-get -y install make gcc g++ libglib2.0-dev libpixman-1-dev libfdt-dev python3-pip ninja-build\n sudo pip3 install meson\n wget https://download.qemu.org/qemu-6.2.0.tar.xz\n tar -xvf qemu-6.2.0.tar.xz\n cd qemu-6.2.0\n sudo ./configure\n sudo make -j 4\n sudo make install\n cd ..\n cp /usr/local/bin/qemu-x86_64 /usr/bin/qemu-x86_64\n fi\n' > qemu_install.sh
chmod +x qemu_install.sh
./qemu_install.sh
GOARCH=amd64 go test -c .
qemu-x86_64 -cpu max ./sonic.test -test.v
fi

0 comments on commit 48187b5

Please sign in to comment.