-
-
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.
Merge pull request #53 from sendahug/Dev
This update contains: -Dependency updates -Migration from Travis CI to CircleCI -Workflow to automate PR testing to Dev and master -User Icons support!
- Loading branch information
Showing
13 changed files
with
282 additions
and
90 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
version: 2.1 | ||
parameters: | ||
run_workflow_build: | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: cimg/python:3.9.0 | ||
environment: | ||
FLASK_CONFIG: testing | ||
TEST_DATABASE_URL: postgresql://postgres:password@localhost:5432/test-capstone?sslmode=disable | ||
- image: circleci/postgres:12.5 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: test-capstone | ||
POSTGRES_PASSWORD: "password" | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }} | ||
- run: sudo apt-get update | ||
- run: sudo apt-get install -y postgresql-client | ||
- run: | ||
name: Install Python deps | ||
command: | | ||
pip3 install -r requirements.txt | ||
python3 -m pip install --upgrade pip | ||
- run: | ||
name: Install coverage and codecov | ||
command: | | ||
sudo apt-get install -y python3-pip | ||
sudo pip3 install coverage | ||
sudo pip3 install codecov | ||
# Dockerize installation to wait for the database to load | ||
# Taken from: https://support.circleci.com/hc/en-us/articles/360006773953-Race-Conditions-Wait-For-Database | ||
- run: | ||
name: install dockerize | ||
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
environment: | ||
DOCKERIZE_VERSION: v0.3.0 | ||
- run: | ||
name: Wait for db | ||
command: dockerize -wait tcp://localhost:5432 -timeout 1m | ||
- run: | ||
name: Restore database | ||
command: psql -h localhost -p 5432 -U postgres test-capstone < capstone_db.sql | ||
- save_cache: | ||
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }} | ||
paths: | ||
- "/usr/local/lib/python3.9/site-packages" | ||
- run: | ||
command: | | ||
coverage run test_app.py | ||
# Conditionally run testing depending on branch | ||
# Once it's done, run codecov to upload test coverage | ||
workflows: | ||
test: | ||
when: | ||
or: | ||
- << pipeline.parameters.run_workflow_build >> | ||
- equal: [ master, << pipeline.git.branch >> ] | ||
- equal: [ Dev, << pipeline.git.branch >> ] | ||
jobs: | ||
- build: | ||
post-steps: | ||
- run: | ||
command: codecov |
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,23 @@ | ||
# Trigger CircleCI build | ||
name: Trigger Build | ||
|
||
# Controls when the action will run. Triggers the workflow on pull request | ||
# events but only for the master branch | ||
on: | ||
pull_request: | ||
branches: [ master, Dev ] | ||
|
||
# Trigger CircleCI build via the API | ||
jobs: | ||
curl: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:3.9.1 | ||
steps: | ||
- run: >- | ||
curl -X POST "https://circleci.com/api/v2/project/gh/sendahug/send-hug-backend/pipeline" | ||
--header 'Circle-Token: ${{ secrets.CIRCLE_CI_ACCESS_TOKEN }}' | ||
--header 'content-type: application/json' | ||
--header 'x-attribution-actor-id: ${{ github.actor }}' | ||
--header 'x-attribution-login: ${{ github.actor }}' | ||
--data '{"branch": "pull/${{ github.event.pull_request.number }}/head", "parameters":{"run_workflow_build":true}}' |
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,31 @@ | ||
# configure updates globally | ||
# default: all | ||
# allowed: all, insecure, False | ||
update: insecure | ||
|
||
# configure dependency pinning globally | ||
# default: True | ||
# allowed: True, False | ||
pin: True | ||
|
||
# set the default branch | ||
# default: empty, the default branch on GitHub | ||
branch: Dev | ||
|
||
# update schedule | ||
# default: empty | ||
# allowed: "every day", "every week", .. | ||
schedule: "every day" | ||
|
||
# search for requirement files | ||
# default: True | ||
# allowed: True, False | ||
search: True | ||
|
||
# configure the branch prefix the bot is using | ||
# default: pyup- | ||
branch_prefix: pyup- | ||
|
||
# allow to close stale PRs | ||
# default: True | ||
close_prs: True |
This file was deleted.
Oops, something went wrong.
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
Binary file not shown.
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,32 @@ | ||
"""empty message | ||
Revision ID: d8921945f241 | ||
Revises: 5aa132f978ec | ||
Create Date: 2020-12-20 13:04:33.808749 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'd8921945f241' | ||
down_revision = '5aa132f978ec' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('users', sa.Column('icon_colours', sa.String(), | ||
nullable=True)) | ||
op.add_column('users', sa.Column('selected_character', | ||
sa.String(length=6), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('users', 'selected_character') | ||
op.drop_column('users', 'icon_colours') | ||
# ### end Alembic commands ### |
Oops, something went wrong.