Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Added github action workflow for CI/CD (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongnansu authored May 6, 2020
1 parent 6b58f80 commit 9cb150a
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release SQL CLI Artifacts
# This workflows is triggered on creating tags to master or an opendistro release branch
on:
push:
# TODO: use tags in next release
branches:
- 'opendistro-*'

jobs:
build:

runs-on: [ubuntu-16.04]
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/*
44 changes: 44 additions & 0 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test and Build

on: [pull_request, push]

jobs:
build:

runs-on: [ubuntu-16.04]
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 Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install setuptools wheel
# TODO: this test will pass, because we haven't spin up an ES instance
- name: Run Tox Testing
run: tox

- 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: opendistro-sql-cli-builds
2 changes: 1 addition & 1 deletion odfesql_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
__version__ = "1.0"
__version__ = "1.7.0.0"

0 comments on commit 9cb150a

Please sign in to comment.