Last active
December 2, 2020 15:48
-
-
Save thomaspoignant/6a8f2c50da645fda7fb506397375de6b to your computer and use it in GitHub Desktop.
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
language: python | |
python: "3.8" | |
env: | |
global: | |
# GITHUB_TOKEN to open PR | |
- secure: "XXX" | |
# AWS ACCESS KEY | |
- secure: "XXX" | |
# AWS SECRET KEY | |
- secure: "XXX" | |
stages: | |
- test | |
- pull_request | |
- release | |
before_install: | |
- npm i -g aws-cdk@1.76.0 # Install CDK | |
- pip install -r requirements.txt --use-feature=2020-resolver # Download CDK python depedencies | |
jobs: | |
include: | |
- stage: test | |
name: "Test" | |
script: | |
- pytest --junitxml=junit-report.xml | |
- stage: test | |
name: "Lint" | |
before_script: | |
- pip install yamllint flake8 flake8-checkstyle | |
script: | |
- flake8 $(shell git ls-files '*.py') | |
- yamllint -f parsable $(shell git ls-files '*.yml' '*.yaml') | |
- stage: test | |
name: "Coverage" | |
before_script: | |
- pip install coverage | |
script: | |
- coverage run --omit "*/virtualenv/*,*/tests/*" -m pytest | |
- stage: test | |
script: | |
- cdk synth -c stage=dev | |
- stage: test | |
script: | |
- cdk synth -c stage=pre | |
- stage: test | |
script: | |
- cdk synth -c stage=pro | |
- stage: pull_request | |
name: "Open Pull request" | |
if: branch = master AND type != cron AND type != pull_request | |
before_script: | |
- wget https://github.com/cli/cli/releases/download/v1.0.0/gh_1.0.0_linux_amd64.deb && sudo dpkg -i gh_*.deb # Install GitHub cli | |
- gh auth login --with-token <<<"${GITHUB_TOKEN}" # Authentication via the github cli. | |
script: | |
- source ./cdk_open_pull_requests.sh | |
- open_pull_requests | |
- stage: deploy | |
deploy: | |
skip_cleanup: true | |
on: | |
branch: dev | |
provider: script | |
script: cdk deploy -c stage=dev | |
- stage: deploy | |
deploy: | |
skip_cleanup: true | |
on: | |
branch: pre | |
provider: script | |
script: cdk deploy -c stage=pre | |
- stage: deploy | |
deploy: | |
skip_cleanup: true | |
on: | |
branch: pro | |
provider: script | |
script: cdk deploy -c stage=pro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment