diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 504f3e64c..84ced4e00 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,25 +9,13 @@ on: workflow_dispatch: {} jobs: - get-go-version: - runs-on: ubuntu-latest - outputs: - go-version: ${{ steps.read-go-version.outputs.version }} - steps: - - uses: actions/checkout@v3 - - id: read-go-version - name: Determine Go version from go.mod - run: echo "::set-output name=version::$(grep "go 1." go.mod | cut -d " " -f 2)" - golangci-lint: runs-on: ubuntu-latest - needs: - - get-go-version steps: + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: ${{ needs.get-go-version.outputs.go-version }} - - uses: actions/checkout@v3 + go-version-file: go.mod - uses: actions/cache@v3 with: path: | @@ -44,13 +32,11 @@ jobs: staticcheck: runs-on: ubuntu-latest - needs: - - get-go-version steps: + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: ${{ needs.get-go-version.outputs.go-version }} - - uses: actions/checkout@v3 + go-version-file: go.mod - uses: actions/cache@v3 with: path: | @@ -64,14 +50,15 @@ jobs: install-go: false unit-tests: - runs-on: ubuntu-latest - needs: - - get-go-version + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: ${{ needs.get-go-version.outputs.go-version }} - - uses: actions/checkout@v3 + go-version-file: go.mod - uses: actions/cache@v3 with: path: | @@ -82,23 +69,23 @@ jobs: ${{ runner.os }}-ut- - name: Check Go modules run: | - go mod tidy && git add go.* + go mod tidy && git add go.* && git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1); - name: Check manifests run: | - make manifests && git add config + make manifests && git add config && git diff --cached --exit-code || (echo 'Please run "make manifests" to generate manifests' && exit 1); - name: Check auto-generated codes run: | - make generate && git add apis + make generate && git add apis && git diff --cached --exit-code || (echo 'Please run "make generate" to generate Go codes' && exit 1); - name: Verify gofmt run: | - make fmt && git add pkg cmd + make fmt && git add pkg cmd && git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1); - name: Verify govet run: | - make vet && git add pkg cmd + make vet && git add pkg cmd && git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1); - name: Run Go build run: make build-koordlet build-koord-manager build-koord-scheduler @@ -106,6 +93,7 @@ jobs: run: make test - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + if: matrix.os == 'ubuntu-latest' with: flags: unittests file: cover.out diff --git a/README.md b/README.md index dfee2caa6..070bd9113 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![License](https://img.shields.io/badge/License-Apache_2.0-4EB1BA.svg)](https://opensource.org/licenses/Apache-2.0) [![codecov](https://codecov.io/github/koordinator-sh/koordinator/branch/main/graph/badge.svg?token=CPUKM09WJL)](https://codecov.io/github/koordinator-sh/koordinator) +[![CI](https://github.com/koordinator-sh/koordinator/actions/workflows/ci.yaml/badge.svg)](https://github.com/koordinator-sh/koordinator/actions/workflows/ci.yaml) [![PRs Welcome](https://badgen.net/badge/PRs/Welcome/green?icon=https://api.iconify.design/octicon:git-pull-request.svg?color=white)](CONTRIBUTING.md) [![Slack](https://badgen.net/badge/Slack/Join/4A154B?icon=slack)](https://join.slack.com/t/koordinator-sh/shared_invite/zt-1756qoub4-Cn4~esfdlfAPsD7cwO2NzA)