Skip to content

Adding opensearch versions to integration test matrix (#89) #165

Adding opensearch versions to integration test matrix (#89)

Adding opensearch versions to integration test matrix (#89) #165

name: Build and Test opensearch-cli
on:
push:
branches:
- main
- opensearch-*
pull_request:
branches:
- main
- opensearch-*
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Go ubuntu-latest
uses: actions/setup-go@v2
with:
go-version: 1.18.2
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Check out source code
uses: actions/checkout@v3
- name: Format check
run: goimports -w .
- name: Check for modified files
id: git-check
run: |
echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Display unformated changes and fail if any
if: steps.git-check.outputs.modified == 'true'
run: |
echo "Found some files are dirty. Please add changes to index and ammend commit".
git diff
exit 1
- name: Lint check
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.50.1
- name: Run Unit Tests
env:
GOPROXY: "https://proxy.golang.org"
run: |
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: coverage.out
flags: opensearch-cli
name: codecov-umbrella
build:
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
go-version: [ 1.18.2 ]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go ${{ matrix.platform }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out source code
uses: actions/checkout@v3
- name: Build for ${{ matrix.platform }}-${{ matrix.go-version }}
env:
GOPROXY: "https://proxy.golang.org"
run: go build .