From f2ea640dd6ad5dd880b4a4cf9282e1255834c4a3 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 14 Jul 2021 19:01:05 +0800 Subject: [PATCH] [parser] .github: migrate ci to GitHub Actions (#1247) --- parser/.github/workflows/itcase.yml | 38 ++++++++++++++++++ parser/.github/workflows/unittest.yml | 58 +++++++++++++++++++++++++++ parser/circle.yml | 33 +++------------ 3 files changed, 101 insertions(+), 28 deletions(-) create mode 100644 parser/.github/workflows/itcase.yml create mode 100644 parser/.github/workflows/unittest.yml diff --git a/parser/.github/workflows/itcase.yml b/parser/.github/workflows/itcase.yml new file mode 100644 index 0000000000..884450f17f --- /dev/null +++ b/parser/.github/workflows/itcase.yml @@ -0,0 +1,38 @@ +name: Integration Test + +on: + push: + branches: + - master + - release-5.0 + - release-4.0 + - release-3.0 + pull_request: + branches: + - master + - release-5.0 + - release-4.0 + - release-3.0 + +jobs: + test: + # TODO: skip for now as resource limitation + if: false + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + with: + path: parser + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: test + run: | + git clone https://github.com/pingcap/tidb.git + cd tidb + rm go.sum + GO111MODULE=on go mod edit -replace github.com/pingcap/parser=$GITHUB_WORKSPACE/parser + go mod tidy + make gotest diff --git a/parser/.github/workflows/unittest.yml b/parser/.github/workflows/unittest.yml new file mode 100644 index 0000000000..8dcdc23bcf --- /dev/null +++ b/parser/.github/workflows/unittest.yml @@ -0,0 +1,58 @@ +name: Unit Test +on: + push: + branches: + - master + - release-5.0 + - release-4.0 + - release-3.0 + pull_request: + branches: + - master + - release-5.0 + - release-4.0 + - release-3.0 + +jobs: + generated: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: validation + run: | + mv parser.go parser.go.committed + make parser + diff -u parser.go.committed parser.go + + format: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: format + run: make fmt + + test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: test + run: make test + - name: codecov + uses: codecov/codecov-action@v1 diff --git a/parser/circle.yml b/parser/circle.yml index 52722dd4d6..d956575497 100644 --- a/parser/circle.yml +++ b/parser/circle.yml @@ -7,38 +7,15 @@ jobs: working_directory: /go/src/github.com/pingcap/parser steps: - checkout - - run: - name: "Verify parser.go is up-to-date" - command: | - mv parser.go parser.go.committed - make parser - diff -u parser.go.committed parser.go - - run: - name: "Check code format" - command: make fmt - - run: - name: "Build & Test" - command: make test - - run: - name: "Upload coverage" - command: bash <(curl -s https://codecov.io/bash) + - run: echo skip build-integration: docker: - - image: golang:1.16 + - image: golang:1.16 working_directory: /go/src/github.com/pingcap/parser steps: - - checkout - - run: - name: "Integration Test" - command: | - cd /go/src/github.com/pingcap/ - git clone git@github.com:pingcap/tidb.git - cd tidb - rm go.sum - GO111MODULE=on go mod edit -replace github.com/pingcap/parser=github.com/${CIRCLE_PR_USERNAME:-$CIRCLE_PROJECT_USERNAME}/${CIRCLE_PR_REPONAME:-$CIRCLE_PROJECT_REPONAME}@$CIRCLE_SHA1 - go mod tidy - # use only 1 thread to minimize memory usage (we've only got 2 CPU + 4 GB on Circle CI). - make gotest P=1 + - checkout + - run: echo skip + workflows: version: 2 build_and_test: