2021-10-06 06:10:33 -05:00
|
|
|
default:
|
2021-10-06 06:28:03 -05:00
|
|
|
image: python:3.9-alpine
|
2021-10-06 06:10:33 -05:00
|
|
|
before_script:
|
2021-10-06 06:28:03 -05:00
|
|
|
- apk add build-base
|
2021-10-06 06:22:35 -05:00
|
|
|
- apk add --no-cache postgresql-libs
|
|
|
|
- apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev
|
2021-10-06 06:54:21 -05:00
|
|
|
- python3.9 -m pip install -r requirements.txt
|
2021-10-06 06:22:35 -05:00
|
|
|
- apk --purge del .build-deps
|
2021-10-06 05:51:28 -05:00
|
|
|
|
2021-10-06 06:49:16 -05:00
|
|
|
stages: # List of stages for jobs, and their order of execution
|
|
|
|
- Test
|
|
|
|
- Build Wheel
|
|
|
|
|
2021-10-06 05:51:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
# unit-test-job: # This job runs in the test stage.
|
|
|
|
# stage: test # It only starts when the job in the build stage completes successfully.
|
|
|
|
# script:
|
|
|
|
# - echo "Running unit tests... This will take about 60 seconds."
|
|
|
|
# - sleep 60
|
|
|
|
# - echo "Code coverage is 90%"
|
|
|
|
|
2021-10-06 06:49:16 -05:00
|
|
|
pylint:
|
2021-10-06 06:49:52 -05:00
|
|
|
stage: Test
|
2021-10-06 06:49:16 -05:00
|
|
|
before_script:
|
2021-10-06 06:54:21 -05:00
|
|
|
- python3.9 -m pip install pylint pylint-exit anybadge
|
2021-10-06 06:49:16 -05:00
|
|
|
script:
|
|
|
|
- mkdir ./pylint
|
2021-10-06 06:54:21 -05:00
|
|
|
- python3.9 -m pylint --output-format=text asyncdb | tee ./pylint/pylint.log || pylint-exit "${?}"
|
2021-10-06 06:49:16 -05:00
|
|
|
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
|
|
|
|
- anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
|
|
|
|
- echo "Pylint score is "${PYLINT_SCORE}"
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- ./pylint/
|
|
|
|
|
|
|
|
|
|
|
|
build-job: # This job runs in the build stage, which runs first.
|
|
|
|
stage: Build Wheel
|
|
|
|
script:
|
|
|
|
- echo "Attempting to build distribution wheel"
|
|
|
|
- python -m build --wheel
|
|
|
|
- echo "Wheel successfully built!"
|