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.
66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
version: 2.1
|
|
|
|
x-environment: &environment
|
|
parameters:
|
|
python-version:
|
|
type: string
|
|
docker:
|
|
- image: circleci/python:<< parameters.python-version >>
|
|
|
|
jobs:
|
|
test:
|
|
<<: *environment
|
|
steps:
|
|
- checkout
|
|
- &install
|
|
run:
|
|
name: Install packages
|
|
command: |
|
|
pip3 install --upgrade pip
|
|
pip3 install -r py<< parameters.python-version >>-requirements.txt
|
|
- run:
|
|
name: Install specific packages
|
|
command: pip3 install pytest
|
|
- run: pytest
|
|
license-scan:
|
|
<<: *environment
|
|
steps:
|
|
- checkout
|
|
- run: # Only run license checks if we have changes in requirements.txt
|
|
name: Check for changes
|
|
command: |
|
|
if [ -z "<< pipeline.git.base_revision >>" ]; then
|
|
echo "No previous build, run license check by default."
|
|
elif git diff-tree --no-commit-id --name-only -r << pipeline.git.revision >> << pipeline.git.base_revision >> | grep ".allowed-licenses\|py<< parameters.python-version >>-requirements.txt" ; then
|
|
echo "Changes in .allowed-licenses or py<< parameters.python-version >>-requirements.txt, run license check."
|
|
else
|
|
echo "No relevant changes found, skip running license check."
|
|
circleci-agent step halt
|
|
fi
|
|
- *install
|
|
- run:
|
|
name: Install specific packages
|
|
command: pip3 install pip-licenses
|
|
- run: # Read allowed licenses from file to ";"-separated string while removing empty lines and comments
|
|
name: License check
|
|
command: |
|
|
ALLOWED=$(sed -e '/^#.*$/d' -e '/^\s*$/d' .allowed-licenses | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/;/g'); echo $ALLOWED
|
|
pip-licenses --from=mixed --allow-only="${ALLOWED}" --summary
|
|
|
|
x-version-matrix: &version-matrix
|
|
matrix:
|
|
parameters:
|
|
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9"]
|
|
|
|
workflows:
|
|
all-tests:
|
|
jobs:
|
|
- test:
|
|
matrix:
|
|
parameters:
|
|
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9"]
|
|
- license-scan:
|
|
matrix:
|
|
parameters:
|
|
python-version: [ "3.6", "3.7", "3.8", "3.9" ]
|