Skip to content

Commit

Permalink
Improve CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Apr 29, 2023
1 parent 5ca7469 commit 159814b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
go-version: ["1.18", "1.19", "1.20"]
go-version: ["1.19", "1.20"]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: ["1.18", "1.19", "1.20"]
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.19", "1.20"]
runs-on: ${{ matrix.os }}
steps:
- name: Install tools
Expand All @@ -19,6 +19,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Test
if: matrix.os != 'ubuntu-latest'
run: go test -v ./pkg/...
- name: Test with coverage
if: matrix.os == 'ubuntu-latest'
run: go test -v -coverprofile=coverage.txt -covermode=atomic ./pkg/...
- name: Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
- name: End to end test
run: make e2e
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ build-linux:
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o ${OUT}/linux/$(BINARY_NAME) -v ${CMD}
ut:
go test github.com/wtetsu/gaze/pkg/...
e2e:
go build -ldflags "-s -w" -o test/e2e -v ${CMD}
cd test/e2e && sh test_all.sh

cov:
go test -coverprofile=coverage.txt -covermode=atomic github.com/wtetsu/gaze/pkg/...
clean:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/test01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ filedir=$dir/files
cd $dir
rm -f test.*.log

timeout -sKILL 3 ${gaze} -v files/*.* | tee test.log &
timeout -sKILL 5 ${gaze} -v files/*.* | tee test.log &

sleep 0.2
sleep 1.0
echo >> $filedir/hello.rb
sleep 0.2
echo >> $filedir/hello.go
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/test02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ filedir=$dir/files
cd $dir
rm -f test.*.log

timeout -sKILL 3 ${gaze} -v -c "ruby {{file}} 1" -r files/*.* | tee test.log &
timeout -sKILL 5 ${gaze} -v -c "ruby {{file}} 1" -r files/*.* | tee test.log &

sleep 1.0
echo >> $filedir/hello.rb
sleep 0.2
echo >> $filedir/hello.rb
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/test03.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ cp $filedir/hello.py "$filedir/he&llo.py"
cp $filedir/hello.py "$filedir/he llo.py"
cp $filedir/hello.py "$filedir/he(llo.py"

timeout -sKILL 3 ${gaze} -v files/*.* | tee test.log &
timeout -sKILL 5 ${gaze} -v files/*.* | tee test.log &

sleep 0.2
sleep 1.0
echo >> "$filedir/he'llo.py"
sleep 0.2
echo >> "$filedir/he&llo.py"
Expand Down

0 comments on commit 159814b

Please sign in to comment.