-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from DemocracyClub/hotfix/fix-ci
Fix CI and get tests running again
- Loading branch information
Showing
9 changed files
with
630 additions
and
1,019 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
python: circleci/[email protected] | ||
python: circleci/[email protected] | ||
|
||
jobs: | ||
install_and_update_dependencies: | ||
docker: | ||
- image: circleci/python:3.8.6-node | ||
- image: cimg/python:3.8.6-node | ||
working_directory: ~/repo | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v2-dependencies-{{ checksum "Pipfile.lock" }}-{{ checksum "thumbs/Pipfile.lock" }} | ||
- v2-dependencies-default | ||
- run: &install-pipenv sudo pip install -U urllib3 cryptography==3.3.2 pipenv pip --quiet --no-input | ||
- run: sudo pip uninstall -y poetry | ||
- run: pipenv install --dev | ||
- run: pipenv check # before save_cache so an insecure cache is never saved | ||
- v3-dependencies-{{ checksum "Pipfile.lock" }}-{{ checksum "thumbs/Pipfile.lock" }} | ||
- v3-dependencies-default | ||
# Ensure pip and pipenv are installed | ||
- run: | ||
name: Install pipenv | ||
command: | | ||
pip install --upgrade pipenv pip --quiet --no-input | ||
- run: pip uninstall -y poetry | ||
- run: | ||
name: Set up virtual environment | ||
command: | | ||
pipenv sync --dev | ||
- run: make lambda-layers/DependenciesLayer/requirements.txt | ||
- run: pipenv run collectstatic | ||
- run: npm install | ||
- run: npm run build | ||
- persist_to_workspace: | ||
|
@@ -28,35 +36,37 @@ jobs: | |
when: on_success | ||
paths: | ||
- ~/.local/share/virtualenvs/ | ||
key: v2-dependencies-{{ checksum "Pipfile.lock" }}-{{ checksum "thumbs/Pipfile.lock" }} | ||
|
||
key: v3-dependencies-{{ checksum "Pipfile.lock" }}-{{ checksum "thumbs/Pipfile.lock" }} | ||
run-tests: | ||
docker: | ||
- image: circleci/python:3.8.6 | ||
- image: cimg/python:3.8 | ||
environment: | ||
CIRCLECI: true | ||
PGHOST: 127.0.0.1 | ||
- image: cimg/postgres:16.3 | ||
environment: | ||
POSTGRES_USER: electionleaflets | ||
POSTGRES_DB: electionleaflets | ||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v2-dependencies-{{ checksum "Pipfile.lock" }} | ||
- v2-dependencies-default | ||
- run: *install-pipenv | ||
# - run: | ||
# command: pipenv run black-check | ||
# name: Black | ||
- run: pipenv run collectstatic | ||
# - run: | ||
# command: pipenv run pytest --flakes | ||
# name: Flakes | ||
# - run: | ||
# command: pipenv run pytest --junitxml=test-results/junit.xml --cov | ||
# name: Run Tests | ||
# - run: | | ||
# if [ -n "$COVERALLS_REPO_TOKEN" ]; then | ||
# pipenv run coveralls | ||
# else | ||
# echo "skipping coverage for forked PR" | ||
# fi | ||
- v3-dependencies-{{ checksum "Pipfile.lock" }} | ||
|
||
# Install dependencies | ||
- run: | ||
name: Install dependencies with pipenv | ||
command: | | ||
pipenv sync --dev | ||
# Run your tests | ||
- run: | ||
name: Run tests | ||
command: | | ||
pipenv run test | ||
- store_artifacts: | ||
path: test-results | ||
destination: test-results | ||
|
@@ -73,7 +83,6 @@ jobs: | |
at: ~/repo/ | ||
- run: pip install --upgrade pip | ||
- run: pip install -r lambda-layers/DependenciesLayer/requirements.txt | ||
- run: make collectstatic | ||
- run: sam build ${DASH_DASH_DEBUG} | ||
|
||
- persist_to_workspace: | ||
|
@@ -84,7 +93,7 @@ jobs: | |
|
||
sam_deploy: | ||
docker: | ||
- image: circleci/python:3.8.6 | ||
- image: cimg/python:3.8.6 | ||
working_directory: ~/repo/ | ||
parameters: | ||
dc-environment: | ||
|
@@ -108,10 +117,9 @@ jobs: | |
at: ~/repo/ | ||
- restore_cache: | ||
keys: | ||
- v2-dependencies-{{ checksum "Pipfile.lock" }} | ||
- v2-dependencies-default | ||
- run: *install-pipenv | ||
|
||
- v3-dependencies-{{ checksum "Pipfile.lock" }} | ||
- v3-dependencies-default | ||
- run: pip install -U pip pipenv --quiet --no-input | ||
- run: printenv DC_DEPLOY_NAME DJANGO_SETTINGS_MODULE SAM_CONFIG_FILE SAM_LAMBDA_CONFIG_ENV SAM_PUBLIC_CONFIG_ENV | ||
- run: printenv SECRET_KEY | md5sum | ||
- run: printenv AWS_ACCESS_KEY_ID | md5sum | ||
|
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
Oops, something went wrong.