diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..80da1bf --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,39 @@ +name: e2e test +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + paths-ignore: + - '**.md' + - '**.png' + pull_request: + paths-ignore: + - '**.md' + - '**.png' +jobs: + job_1: + name: Build goc binary + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + - name: Checkout code + uses: actions/checkout@v2 + - name: Go build + run: | + go build . + - name: Use goc to build self + run: | + ./goc build -o ./gocc . + - name: Upload goc binary + uses: actions/upload-artifact@v2 + with: + name: goc + path: goc + - name: Upload covered self goc binary + uses: actions/upload-artifact@v2 + with: + name: gocc + path: gocc \ No newline at end of file diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml new file mode 100644 index 0000000..f04af15 --- /dev/null +++ b/.github/workflows/style_check.yml @@ -0,0 +1,39 @@ +name: style-check +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + paths-ignore: + - '**.md' + - '**.png' + pull_request: + paths-ignore: + - '**.md' + - '**.png' +jobs: + run: + name: vet and gofmt + strategy: + matrix: + go-version: [1.16.x] + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + # This step checks out a copy of your repository. + - name: Checkout code + uses: actions/checkout@v2 + - name: Go vet check + run: | + go vet ./... + - name: Gofmt check + run: | + diff=`find . -name "*.go" | xargs gofmt -s -d` + if [[ -n "${diff}" ]]; then + echo "Gofmt check failed :" + echo "${diff}" + echo "Please run this command to fix: [find . -name "*.go" | xargs gofmt -s -w]" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/ut-check.yml b/.github/workflows/ut-check.yml new file mode 100644 index 0000000..d2a37d5 --- /dev/null +++ b/.github/workflows/ut-check.yml @@ -0,0 +1,34 @@ +name: ut-check +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + paths-ignore: + - '**.md' + - '**.png' + pull_request: + paths-ignore: + - '**.md' + - '**.png' +jobs: + run: + name: go test + strategy: + matrix: + go-version: [1.16.x] + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + # This step checks out a copy of your repository. + - name: Checkout code + uses: actions/checkout@v2 + - name: Go test + env: + GOVERSION: ${{ matrix.go-version }} + run: | + export DEFAULT_EXCEPT_PKGS=e2e + go test -p 1 -coverprofile=coverage.txt $(go list ./... | grep -v -E $DEFAULT_EXCEPT_PKGS) + bash <(curl -s https://codecov.io/bash) -F unittest-$GOVERSION \ No newline at end of file