Merge pull request #539 from meshery/fix/buildrelease #137
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Meshery-Operator CI | |
on: | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
jobs: | |
golangci-lint: | |
strategy: | |
matrix: | |
platform: [ubuntu-22.04] | |
go-version: [1.21.x] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
args: --timeout=5m | |
codecov: | |
# golandci-lint need to be run before codecov and succeed | |
needs: golangci-lint | |
name: Code Coverage | |
if: github.repository == 'meshery/meshery-operator' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Set up test-env | |
run: make test-env | |
- name: Run unit tests | |
run: go test --short ./... -race -coverprofile=coverage.txt -covermode=atomic | |
- name: Upload coverage to Codecov | |
if: github.repository == 'meshery/meshery-operator' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.txt | |
flags: unittests | |
# if review comment includes approved or LGTM, run the tests | |
# if review comment includes changes requested, do not run the tests | |
# if review comment includes approved or LGTM, run the tests | |
build: | |
needs: [golangci-lint,codecov] | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Build | |
run: make build |