Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Merge all SQL repos and adjust workflows #549

Merged
merged 21 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 55 additions & 0 deletions .github/workflows/sql-cli-release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release SQL CLI Artifacts
# This workflows is triggered on creating tags to master
on:
push:
tags:
- 'v*'

jobs:
build:

runs-on: [ubuntu-16.04]
defaults:
run:
working-directory: sql-cli
strategy:
matrix:
python-version: [3.8]

steps:
- name: Checkout SQL CLI
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# publish to S3 and PyPI
- name: Build and Publish
run: |
python setup.py sdist bdist_wheel
artifact=`ls ./dist/*.tar.gz`
wheel_artifact=`ls ./dist/*.whl`
aws s3 cp $artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-cli/
aws s3 cp $wheel_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-cli/
# aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/downloads/*"

# TODO: Publish to PyPI
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: twine upload dist/*
60 changes: 60 additions & 0 deletions .github/workflows/sql-cli-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: SQL CLI Test and Build

on: [pull_request, push]

jobs:
build:

runs-on: [ubuntu-16.04]
defaults:
run:
working-directory: sql-cli
strategy:
matrix:
python-version: [3.8]

steps:
- name: Checkout SQL CLI
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install setuptools wheel
- name: Set up ES and install SQL plugin
run: |
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-11-jdk
sudo apt install unzip
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.6.1-amd64.deb
sudo dpkg -i elasticsearch-oss-7.6.1-amd64.deb
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-sql/opendistro_sql-1.6.0.0.zip
sudo systemctl start elasticsearch.service
- name: Run Tox Testing
run: tox

- name: Stop ES
run: sudo systemctl stop elasticsearch.service

- name: Build Artifact
run: python setup.py sdist bdist_wheel

- name: Create Artifact Path
run: |
mkdir -p opendistro-sql-cli-builds
cp -r ./dist/*.tar.gz ./dist/*.whl opendistro-sql-cli-builds/
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: opendistro-sql-cli
path: sql-cli/opendistro-sql-cli-builds
49 changes: 49 additions & 0 deletions .github/workflows/sql-jdbc-push-jdbc-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Upload sql-jdbc Jar to Maven

# This workflow will upload the sql-jdbc jar to maven when a new tag is cut
on:
push:
tags:
- v*

jobs:
upload-jdbc-jar:
runs-on: [ubuntu-16.04]
defaults:
run:
working-directory: sql-jdbc
name: Upload Jar to Maven
steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

# Since release workflow uses java 10
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '10'

- name: Upload jdbc Jar to Maven
env:
passphrase: ${{ secrets.PASSPHRASE }}
run: |
cd ..
export JAVA10_HOME=$JAVA_HOME
aws s3 cp s3://opendistro-docs/github-actions/pgp-public-key .
aws s3 cp s3://opendistro-docs/github-actions/pgp-private-key .
gpg --import pgp-public-key
gpg --allow-secret-key-import --import pgp-private-key
mkdir /home/runner/.gradle
aws s3 cp s3://opendistro-docs/github-actions/gradle.properties /home/runner/.gradle/
cd sql-jdbc
./gradlew publishShadowPublicationToSonatype-stagingRepository -Dcompiler.java=10 -Dbuild.snapshot=false -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts
41 changes: 41 additions & 0 deletions .github/workflows/sql-jdbc-release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Release SQL-JDBC
# This workflow is triggered on creating tags to master or an opendistro release branch
on:
push:
tags:
- 'v*'

jobs:
Release-SQL-JDBC:
strategy:
matrix:
java: [10]

name: Build and Release SQL Plugin
runs-on: ubuntu-latest
defaults:
run:
working-directory: sql-jdbc

steps:
- name: Checkout SQL-JDBC
uses: actions/checkout@v1

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Run build
run: |
./gradlew publishShadowPublicationToInternal-releasesRepository '-Dorg.gradle.jvmargs=--add-modules java.xml.bind' -Dbuild.snapshot=false
artifact=`ls -1t build/libs/*.jar | grep -v "SNAPSHOT.jar" | grep -v "sources.jar" | head -1`
aws s3 cp $artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/elasticsearch-clients/opendistro-sql-jdbc/
aws cloudfront create-invalidation --distribution-id E2S86LO5GZAJQM --paths "/downloads/*"
33 changes: 33 additions & 0 deletions .github/workflows/sql-jdbc-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: SQL JDBC Java CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
defaults:
run:
working-directory: sql-jdbc

steps:
- uses: actions/checkout@v1

- name: Set up JDK 1.13
uses: actions/setup-java@v1
with:
java-version: 1.13

- name: Build with Gradle
run: ./gradlew build

- name: Create Artifact Path
run: |
mkdir -p sql-jdbc-builds
cp ./build/libs/*.jar sql-jdbc-builds
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: sql-jdbc
path: sql-jdbc/sql-jdbc-builds
Loading