From 159814b5c3895fc3d5874c54d5b6fda0577680ba Mon Sep 17 00:00:00 2001 From: wtetsu Date: Sat, 29 Apr 2023 15:52:31 +0900 Subject: [PATCH] Improve CI tests --- .github/workflows/build.yml | 2 +- .github/workflows/test.yml | 11 +++++++++-- Makefile | 4 ++++ test/e2e/test01.sh | 4 ++-- test/e2e/test02.sh | 3 ++- test/e2e/test03.sh | 4 ++-- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9f81de..e4346fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3be8111..cc713eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 8d58e50..4d962ca 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/test/e2e/test01.sh b/test/e2e/test01.sh index 52aa30e..cf9f753 100644 --- a/test/e2e/test01.sh +++ b/test/e2e/test01.sh @@ -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 diff --git a/test/e2e/test02.sh b/test/e2e/test02.sh index 9d0438b..e243837 100644 --- a/test/e2e/test02.sh +++ b/test/e2e/test02.sh @@ -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 diff --git a/test/e2e/test03.sh b/test/e2e/test03.sh index c0142b9..72b0dbe 100644 --- a/test/e2e/test03.sh +++ b/test/e2e/test03.sh @@ -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"