You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dda-python-terraform/.gitlab-ci.yml

96 lines
2.0 KiB
YAML

image: "python:3.8"
before_script:
- python --version
- pip install setuptools wheel twine
- pip install .
- pip install -r dev_requirements.txt
stages:
- lint
- test
- build
- upload
flake8:
stage: lint
allow_failure: true
script:
- flake8 --max-line-length=120 --count --select=E9,F63,F7,F82 --show-source --statistics python_terraform/*.py
- flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics python_terraform/*.py
mypy:
stage: lint
allow_failure: true
script:
- python -m mypy python_terraform/terraform.py
- python -m mypy python_terraform/tfstate.py
pylint:
stage: lint
allow_failure: true
script:
- pylint -d C0301 python_terraform/*.py
test-0.13.7:
stage: test
script:
- export TFVER=0.13.7
- export TFURL=https://releases.hashicorp.com/terraform/
- TFURL+=$TFVER
- TFURL+="/terraform_"
- TFURL+=$TFVER
- TFURL+="_linux_amd64.zip"
- wget $TFURL -O terraform_bin.zip
- mkdir tf_bin
- unzip terraform_bin.zip -d tf_bin
- PATH=$PATH:$PWD/tf_bin
- pytest -v
test-1.0.8:
stage: test
script:
- export TFVER=1.0.8
- export TFURL=https://releases.hashicorp.com/terraform/
- TFURL+=$TFVER
- TFURL+="/terraform_"
- TFURL+=$TFVER
- TFURL+="_linux_amd64.zip"
- wget $TFURL -O terraform_bin.zip
- mkdir tf_bin
- unzip terraform_bin.zip -d tf_bin
- PATH=$PATH:$PWD/tf_bin
- pytest -v
test-1.1.3:
stage: test
script:
- export TFVER=1.1.3
- export TFURL=https://releases.hashicorp.com/terraform/
- TFURL+=$TFVER
- TFURL+="/terraform_"
- TFURL+=$TFVER
- TFURL+="_linux_amd64.zip"
- wget $TFURL -O terraform_bin.zip
- mkdir tf_bin
- unzip terraform_bin.zip -d tf_bin
- PATH=$PATH:$PWD/tf_bin
- pytest -v
build:
stage: build
rules:
- if: '$CI_COMMIT_TAG != null'
artifacts:
paths:
- dist/*
script:
- python setup.py sdist bdist_wheel
pypi:
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- twine upload dist/*