From c5beb23ae8f508be7ca578493f0eb60b271b58e6 Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Sun, 27 Oct 2024 21:02:40 +0700 Subject: [PATCH] ci: separate test and lint pipelines (#160) --- .github/workflows/lint.yaml | 36 ++++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 14 ++------------ 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..d48e20a --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,36 @@ +name: Lint + +on: + workflow_call: + push: + paths: + - "**.go" + - "go.mod" + - "go.sum" + - ".github/workflows/*.yaml" + - "example/**" + +jobs: + lint: + name: Run Go lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.21" + - name: Install dependencies + run: | + go get -t -v ./... + go install ./... + - name: Format + run: diff -u <(echo -n) <(gofmt -d -s .) + - name: Vet + run: go vet ./... + - name: Lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + only-new-issues: true + skip-cache: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a5a33f8..6226634 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,7 +5,7 @@ on: pull_request: push: branches: - - "*" + - "main" paths: - "**.go" - "go.mod" @@ -15,7 +15,7 @@ on: jobs: test-go: - name: Run Go lint and unit tests + name: Run unit tests runs-on: ubuntu-latest permissions: pull-requests: write @@ -29,16 +29,6 @@ jobs: run: | go get -t -v ./... go install ./... - - name: Format - run: diff -u <(echo -n) <(gofmt -d -s .) - - name: Vet - run: go vet ./... - - name: Lint - uses: golangci/golangci-lint-action@v6 - with: - version: latest - only-new-issues: true - skip-cache: true - name: Run Go unit tests for the SDK run: | cp go.work.testing go.work