-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add workflows for Github Actions
This patch adds configuration for running checks and tests with Github Actions (https://github.com/elastic/go-elasticsearch/actions).
- Loading branch information
Showing
5 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Build | ||
|
||
on: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
push: | ||
branches: | ||
- github-actions | ||
- master | ||
- 7.x | ||
- 6.x | ||
pull_request: | ||
branches: | ||
- master | ||
- 7.x | ||
- 6.x | ||
|
||
env: | ||
GITHUB_ACTIONS: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- name: Install dependencies | ||
run: go get -u golang.org/x/lint/golint | ||
env: | ||
GOBIN: ${{ env.GOROOT }}/bin | ||
shell: bash | ||
- run: go version | ||
- run: make lint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: API | ||
|
||
on: | ||
schedule: | ||
- cron: '0 2 * * *' | ||
|
||
env: | ||
GITHUB_ACTIONS: true | ||
|
||
jobs: | ||
test-core: | ||
name: Core | ||
env: | ||
ELASTICSEARCH_VERSION: elasticsearch-oss:8.0.0-SNAPSHOT | ||
ELASTICSEARCH_URL: http://localhost:9200 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- run: go version | ||
- name: Increase system limits | ||
run: | | ||
sudo swapoff -a | ||
sudo sysctl -w vm.swappiness=1 | ||
sudo sysctl -w fs.file-max=262144 | ||
sudo sysctl -w vm.max_map_count=262144 | ||
- name: Launch Elasticsearch | ||
run: | | ||
docker pull --quiet docker.elastic.co/elasticsearch/${{ env.ELASTICSEARCH_VERSION }} | ||
docker pull --quiet appropriate/curl | ||
make cluster-clean cluster-update cluster detach=true version="${{ env.ELASTICSEARCH_VERSION }}" | ||
- name: Download Elasticsearch source | ||
run: | | ||
curl -s ${{ env.ELASTICSEARCH_URL }} | jq -r '.version.build_hash' > elasticsearch_build_hash && cat elasticsearch_build_hash | ||
curl -sSL --retry 3 -o elasticsearch-$(cat elasticsearch_build_hash).zip https://github.com/elastic/elasticsearch/archive/$(cat elasticsearch_build_hash).zip && \ | ||
unzip -q -o elasticsearch-$(cat elasticsearch_build_hash).zip '*.properties' '*.json' '*.yml' -d tmp && \ | ||
mv tmp/elasticsearch-$(cat elasticsearch_build_hash)* tmp/elasticsearch | ||
- run: ELASTICSEARCH_BUILD_HASH=$(cat elasticsearch_build_hash) make gen-tests | ||
- run: make test-api | ||
|
||
test-xpack: | ||
name: X-Pack | ||
env: | ||
ELASTICSEARCH_VERSION: elasticsearch:8.0.0-SNAPSHOT | ||
ELASTICSEARCH_URL: https://elastic:elastic@localhost:9200 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- run: go version | ||
- name: Increase system limits | ||
run: | | ||
sudo swapoff -a | ||
sudo sysctl -w vm.swappiness=1 | ||
sudo sysctl -w fs.file-max=262144 | ||
sudo sysctl -w vm.max_map_count=262144 | ||
- name: Launch Elasticsearch | ||
run: | | ||
docker pull --quiet docker.elastic.co/elasticsearch/${{ env.ELASTICSEARCH_VERSION }} | ||
docker pull --quiet appropriate/curl | ||
make cluster-clean cluster-update cluster detach=true version="${{ env.ELASTICSEARCH_VERSION }}" | ||
- name: Download Elasticsearch source | ||
run: | | ||
curl -sSk ${{ env.ELASTICSEARCH_URL }} | ||
curl -sSk ${{ env.ELASTICSEARCH_URL }} | jq -r '.version.build_hash' > elasticsearch_build_hash && cat elasticsearch_build_hash && \ | ||
curl -sSL --retry 3 -o elasticsearch-$(cat elasticsearch_build_hash).zip https://github.com/elastic/elasticsearch/archive/$(cat elasticsearch_build_hash).zip && \ | ||
unzip -q -o elasticsearch-$(cat elasticsearch_build_hash).zip '*.properties' '*.json' '*.yml' -d tmp && \ | ||
mv tmp/elasticsearch-$(cat elasticsearch_build_hash)* tmp/elasticsearch | ||
- run: ELASTICSEARCH_BUILD_HASH=$(cat elasticsearch_build_hash) make gen-tests | ||
- run: make test-api flavor=xpack |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Integration | ||
|
||
on: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
push: | ||
branches: | ||
- github-actions | ||
- master | ||
- 7.x | ||
- 6.x | ||
pull_request: | ||
branches: | ||
- master | ||
- 7.x | ||
- 6.x | ||
|
||
env: | ||
GITHUB_ACTIONS: true | ||
ELASTICSEARCH_VERSION: elasticsearch-oss:8.0.0-SNAPSHOT | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- run: go version | ||
- name: Increase system limits | ||
run: | | ||
sudo swapoff -a | ||
sudo sysctl -w vm.swappiness=1 | ||
sudo sysctl -w fs.file-max=262144 | ||
sudo sysctl -w vm.max_map_count=262144 | ||
- name: Launch Elasticsearch | ||
run: | | ||
docker pull --quiet docker.elastic.co/elasticsearch/${{ env.ELASTICSEARCH_VERSION }} | ||
docker pull --quiet appropriate/curl | ||
make cluster-clean cluster-update cluster detach=true version="${{ env.ELASTICSEARCH_VERSION }}" | ||
- run: make test-integ race=true | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
file: tmp/integration-client.cov | ||
flags: integration | ||
|
||
examples: | ||
name: Examples | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- run: go version | ||
- name: Increase system limits | ||
run: | | ||
sudo swapoff -a | ||
sudo sysctl -w vm.swappiness=1 | ||
sudo sysctl -w fs.file-max=262144 | ||
sudo sysctl -w vm.max_map_count=262144 | ||
- name: Launch Elasticsearch | ||
run: | | ||
docker pull --quiet docker.elastic.co/elasticsearch/${{ env.ELASTICSEARCH_VERSION }} | ||
docker pull --quiet appropriate/curl | ||
make cluster-clean cluster-update cluster detach=true version="${{ env.ELASTICSEARCH_VERSION }}" | ||
- name: Run setup | ||
run: | | ||
cd _examples/encoding && make setup | ||
env: | ||
GOBIN: ${{ env.GOROOT }}/bin | ||
- run: make test-examples |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Unit (tip) | ||
|
||
on: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
env: | ||
GITHUB_ACTIONS: true | ||
|
||
jobs: | ||
test: | ||
name: "go-HEAD @ ubuntu-latest" | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https://github.com/actions/setup-go/issues/21#issuecomment-565741980 | ||
- name: Install Go HEAD | ||
run: | | ||
export GOROOT_BOOTSTRAP=`go env GOROOT` | ||
export GOROOT_FINAL=/go | ||
export GOROOT=$HOME/gotip | ||
mkdir $HOME/gotip | ||
cd $HOME/gotip | ||
curl -s 'https://go.googlesource.com/go/+/refs/heads/master?format=JSON' | awk '/"commit"/{print substr($2,2,40);exit}' >HEAD | ||
awk '{printf("gotip-%s",substr($0,0,7))}' <HEAD >VERSION | ||
curl -s -o go.tar.gz https://go.googlesource.com/go/+archive/`cat HEAD`.tar.gz | ||
tar xfz go.tar.gz | ||
cd src | ||
bash make.bash | ||
echo "::set-env name=GOROOT::$GOROOT" | ||
echo "::add-path::$GOROOT/bin" | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- run: go version | ||
- run: make test-unit race=true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Unit | ||
|
||
on: | ||
schedule: | ||
- cron: '0 1 * * *' | ||
push: | ||
branches: | ||
- github-actions | ||
- master | ||
- 7.x | ||
- 6.x | ||
pull_request: | ||
branches: | ||
- master | ||
- 7.x | ||
- 6.x | ||
|
||
env: | ||
GITHUB_ACTIONS: true | ||
|
||
jobs: | ||
test: | ||
name: "Tests (${{ matrix.os }})" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
go: ['1.x'] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: "${{ matrix.go }}" } | ||
- run: go version | ||
- run: make test-unit race=true | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
file: tmp/unit.cov | ||
flags: unit | ||
if: matrix.os == 'ubuntu-latest' | ||
|
||
bench: | ||
name: Benchmarks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: { fetch-depth: 1 } | ||
- uses: actions/setup-go@v2-beta | ||
with: { go-version: '1.x' } | ||
- run: go version | ||
- run: make test-bench |