57 lines
1.9 KiB
YAML
57 lines
1.9 KiB
YAML
default:
|
|
image: python:3.9-alpine
|
|
before_script:
|
|
- apk add build-base
|
|
- apk add --no-cache postgresql-libs
|
|
- apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev
|
|
- python3 -m pip install -r requirements.txt
|
|
- apk --purge del .build-deps
|
|
|
|
stages: # List of stages for jobs, and their order of execution
|
|
- Test
|
|
- Build Wheel
|
|
|
|
|
|
|
|
# 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%"
|
|
|
|
pylint:
|
|
stage: Static Analysis
|
|
before_script:
|
|
- pip install pylint-exit anybadge
|
|
script:
|
|
- mkdir ./pylint
|
|
- pylint --output-format=text asyncdb | tee ./pylint/pylint.log || pylint-exit "${?}"
|
|
- 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/
|
|
|
|
lint-test-job: # This job also runs in the test stage.
|
|
stage: test
|
|
before_script:
|
|
- pip install pylint pylint-exit anybadge
|
|
script:
|
|
- mkdir ./pylint
|
|
- pylint --output-format=text . | tee ./pylint/pylint.log || pylint-exit $?
|
|
- 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!" |