Skip to content

Commit

Permalink
Fixes #5524 New CI job for app tests on Focal
Browse files Browse the repository at this point in the history
This adds related CI steps for app tests on Focal
  • Loading branch information
kushaldas committed Nov 9, 2020
1 parent ce22827 commit c0471f9
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,49 @@ common-steps:
paths:
- /caches/layers.tar

- &focalcreatecachedir
run:
name: Ensure cache dir exists and permissions are good
command: |
sudo mkdir -p /focalcaches && sudo chown circleci: -R /focalcaches
- &focalestorecache
restore_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/focal/python3/Dockerfile" }}
paths:
- /focalcaches/layers.tar.gz

- &focalloadimagelayers
run:
name: Load image layer cache on Focal
command: |
set +o pipefail
docker load -i /focalcaches/layers.tar || true
- &focaldockerimagebuild
run:
name: Build Docker images for Focal
command: |
set +o pipefail
docker images
fromtag=$(docker images |grep securedrop-test-focal-py3 |head -n1 |awk '{print $2}')
cd securedrop && DOCKER_BUILD_VERBOSE=true DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-focal-py3:${fromtag:-latest}" BASE_OS=focal ./bin/dev-shell true
- &focalsaveimagelayers
run:
name: Save Docker image layer cache on Focal
command: |
docker images
docker save -o /focalcaches/layers.tar securedrop-test-focal-py3:latest
- &focalsavecache
save_cache:
key: v1-sd-layers-{{ checksum "securedrop/dockerfiles/focal/python3/Dockerfile" }}
paths:
- /focalcaches/layers.tar



version: 2
jobs:
lint:
Expand Down Expand Up @@ -80,6 +123,39 @@ jobs:
name: Run shellcheck
command: make shellcheck

focal-app-tests:
machine:
enabled: true
environment:
DOCKER_API_VERSION: 1.23
BASE_OS: xenial
parallelism: 3
steps:
- checkout
- *rebaseontarget
- *focalcreatecachedir
- *focalrestorecache
- *focalloadimagelayers
- *focaldockerimagebuild
- *focalsaveimagelayers
- *focalsavecache

- run:
name: Run tests on Focal
command: |
BRANCH_MATCH=$(devops/scripts/match-ci-branch.sh "^(i18n|update-builder)")
if [[ $BRANCH_MATCH =~ ^found ]]; then echo "Skipping: ${BRANCH_MATCH}"; exit 0; fi
export TESTFILES=$(cd securedrop; circleci tests glob 'tests/test*py' 'tests/**/test*py' |circleci tests split --split-by=timings |xargs echo)
fromtag=$(docker images |grep securedrop-test-focal-py3 |head -n1 |awk '{print $2}')
DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-focal-py3:${fromtag:-latest}" make test-focal
no_output_timeout: 15m

- store_test_results:
path: ~/project/test-results-focal

- store_artifacts:
path: ~/project/test-results-focal

app-tests:
machine:
enabled: true
Expand Down

0 comments on commit c0471f9

Please sign in to comment.