Merge pull request #11 from dineshsonachalam/snyk-fix-5c2966cf4389da4… #270
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: tests | |
on: | |
push: | |
branches: | |
- '**' # matches every branch | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Start integration test | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
pip3 install virtualenv | |
python3 -m venv env | |
source env/bin/activate | |
pip3 install -r requirements-dev.txt | |
python setup.py install | |
pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
deploy-to-pypi: | |
needs: tests | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install package dependencies | |
run: pip3 install -r requirements-dev.txt | |
- name: Build python package and deploy to PYPI | |
run: | | |
rm -rf build dist *.egg-info | |
python3 setup.py sdist bdist_wheel | |
twine upload --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/* | |
upload-docs-docker-image: | |
needs: deploy-to-pypi | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build pdoc docs image | |
run: | | |
sudo pip3 install pdoc3 | |
sudo pip3 install -r requirements-dev.txt | |
sudo pdoc --html ./LucidDynamodb --output-dir ./docs --force | |
docker build --no-cache -t dineshsonachalam/lucid-dynamodb-docs:latest . | |
- name: Log into registry | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push image | |
run: | | |
docker push dineshsonachalam/lucid-dynamodb-docs:latest | |
deploy-to-k8-cluster: | |
needs: upload-docs-docker-image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: danielr1996/kubectl-action@1.0.0 | |
name: Docs deployment rolling restart to fetch recently build docker image from docker hub. | |
with: | |
kubeconfig: ${{ secrets.KUBE_CONFIG_DATA }} | |
args: rollout restart deployment lucid-docs -n=dinesh | |
- uses: danielr1996/kubectl-action@1.0.0 | |
name: Verify deployment for docs app | |
with: | |
kubeconfig: ${{ secrets.KUBE_CONFIG_DATA }} | |
args: rollout status deployment/lucid-docs -n=dinesh | |
auto-update-readme: | |
needs: deploy-to-k8-cluster | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Markdown autodocs | |
uses: dineshsonachalam/markdown-autodocs@v1.0.3 |