-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gdesmar
committed
Nov 4, 2021
1 parent
f47ee64
commit a93e06d
Showing
3 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: build | ||
|
||
trigger: | ||
tags: | ||
include: ["v*"] | ||
pr: none | ||
|
||
pool: | ||
vmImage: "ubuntu-20.04" | ||
|
||
stages: | ||
- stage: deploy | ||
jobs: | ||
- job: deploy | ||
displayName: Deploy containers to dockerhub | ||
variables: | ||
- group: deployment-information | ||
steps: | ||
- task: Docker@2 | ||
displayName: Login to docker hub | ||
inputs: | ||
command: login | ||
containerRegistry: dockerhub | ||
- script: | | ||
export TAG=${BUILD_SOURCEBRANCH#"refs/tags/v"} | ||
if [[ "$TAG" == *stable* ]]; then export BUILD_TYPE=stable; else export BUILD_TYPE=latest; fi | ||
docker build --build-arg version=$TAG --build-arg branch=$BUILD_TYPE -t cccs/${BUILD_REPOSITORY_NAME##*/}:$TAG -t cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE -f ./Dockerfile . | ||
displayName: Build containers | ||
- script: | | ||
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit | ||
[ -f "$(pwd)/tests/requirements.txt" ] && docker run -v $(pwd)/tests/:/opt/al_service/tests/ cccs/${BUILD_REPOSITORY_NAME##*/}:latest bash -c 'pip install -U -r tests/requirements.txt; pytest -p no:cacheprovider' && exit | ||
docker run -v $(pwd)/tests/:/opt/al_service/tests/ cccs/${BUILD_REPOSITORY_NAME##*/}:latest bash -c 'pytest -p no:cacheprovider' | ||
displayName: Test containers | ||
- script: docker push cccs/${BUILD_REPOSITORY_NAME##*/} --all-tags | ||
displayName: Deploy to Docker Hub |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: tests | ||
|
||
trigger: ["*"] | ||
pr: ["*"] | ||
|
||
pool: | ||
vmImage: "ubuntu-20.04" | ||
|
||
jobs: | ||
- job: run_test | ||
strategy: | ||
matrix: | ||
python3_7: | ||
python.version: "3.7" | ||
Python3_8: | ||
python.version: "3.8" | ||
Python3_9: | ||
python.version: "3.9" | ||
|
||
timeoutInMinutes: 10 | ||
|
||
steps: | ||
- task: UsePythonVersion@0 | ||
displayName: Set python version | ||
inputs: | ||
versionSpec: "$(python.version)" | ||
- script: | | ||
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit | ||
sudo apt-get update | ||
sudo apt-get install -y libfuzzy-dev libfuzzy2 | ||
if [ -f $(pwd)/pkglist.txt ]; then | ||
sudo apt-get install -y < $(pwd)/pkglist.txt | ||
fi | ||
sudo rm -rf /var/lib/apt/lists/* | ||
sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir assemblyline assemblyline_v4_service | ||
[ -f $(pwd)/requirements.txt ] && sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir -r $(pwd)/requirements.txt | ||
[ -f $(pwd)/tests/requirements.txt ] && sudo env "PATH=$PATH" python -m pip install -U --no-cache-dir -r $(pwd)/tests/requirements.txt | ||
sudo rm -rf /tmp/* /var/lib/apt/lists/* ~/.cache/pip | ||
displayName: Setup environment | ||
- script: | | ||
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit | ||
export REPO_NAME=${BUILD_REPOSITORY_NAME##*/} | ||
python -m pytest -p no:cacheprovider --durations=10 -rsx -vv --cov-report=xml --cov=${REPO_NAME/assemblyline-service-/} | ||
displayName: Test | ||
- script: | | ||
[ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit | ||
python -m codecov | ||
displayName: Upload Coverage |