For a first pass, I went through and cleaned up anything I thought that might be more presentable from comments and very basic code formatting. This is to allow my brain to more easily absorb and identify content without getting distracted by more obvious but less pertinent concerns. In a real code review, I would also be taking into account whether it was appropriate to spend resources on this and whether there might be interpersonal
This file contains hidden or 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
| - run: | |
| name: Start Postgres # Start the service and add a test-running user (sudo sudo is not a typo) | |
| command: | | |
| # Set permissions to trust | |
| sudo sh -c 'sed -i "s/peer/trust/g" /etc/postgresql/<< pipeline.parameters.postgres-version >>/main/pg_hba.conf' | |
| sudo sh -c 'sed -i "s/md5/trust/g" /etc/postgresql/<< pipeline.parameters.postgres-version >>/main/pg_hba.conf' | |
| # Disable ssl, as it can cause tests to fail likely due to use of the multiprocessing library | |
| sudo sh -c 'sed -i "s/ssl = on/ssl = off/g" /etc/postgresql/<< pipeline.parameters.postgres-version >>/main/postgresql.conf' | |
This file contains hidden or 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
| - run: | |
| name: Start Postgres # Start the service and add a test-running user (sudo sudo is not a typo) | |
| command: | | |
| # Set permissions to trust | |
| sudo sh -c 'sed -i "s/peer/trust/g" /etc/postgresql/<< pipeline.parameters.postgres-version >>/main/pg_hba.conf' | |
| sudo sh -c 'sed -i "s/md5/trust/g" /etc/postgresql/<< pipeline.parameters.postgres-version >>/main/pg_hba.conf' | |
| # Start the Postgres cluster service | |
| sudo pg_ctlcluster << pipeline.parameters.postgres-version >> main start | |
This file contains hidden or 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
| # DO NOT DISABLE! | |
| # If you change this first entry you will need to make sure that the | |
| # database superuser can access the database using some other method. | |
| # Noninteractive access to all databases is required during automatic | |
| # maintenance (custom daily cronjobs, replication, and similar tasks). | |
| # | |
| # Database administrative login by Unix domain socket | |
| local all postgres peer | |
| # TYPE DATABASE USER ADDRESS METHOD |
This file contains hidden or 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
| - run: | |
| name: Start Postgres # Start the service and add a test-running user (sudo sudo is not a typo) | |
| command: | | |
| # Start the Postgres cluster service | |
| sudo pg_ctlcluster << pipeline.parameters.postgres-version >> main start | |
| # Add the "<< pipeline.parameters.db-user >>" user in the event of a fresh db | |
| sudo sudo -u postgres psql postgres -c "CREATE USER << pipeline.parameters.db-user >> WITH LOGIN SUPERUSER;" |
This file contains hidden or 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
| - run: | |
| name: install postgres repository | |
| command: | | |
| # Create the file repository configuration: | |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
| # Import the repository signing key: | |
| wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
| - run: |
This file contains hidden or 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
| version: 2.1 | |
| parameters: | |
| postgres-version: | |
| type: string | |
| default: "11" | |
| db-user: | |
| type: string | |
| default: "db_user" | |
| jobs: |
This file contains hidden or 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
| version: 2.1 | |
| jobs: | |
| build: | |
| docker: | |
| - image: cimg/python:3.7.13 | |
| environment: | |
| ENVIRONMENT: staging | |
| RMP_DB_ENGINE: django.db.backends.postgresql_psycopg2 | |
| RMP_DB_NAME: app_db | |
| RMP_DB_USER: app_user |
This file contains hidden or 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
| CREATE TEMP TABLE raw_input ( | |
| line TEXT, | |
| line_id SERIAL PRIMARY KEY | |
| ); | |
| \COPY raw_input (line) FROM ~/Downloads/input12.txt | |
| CREATE TEMP TABLE directions AS | |
| SELECT LEFT(line, 1) AS command_type, | |
| SUBSTRING(line FROM 2)::INTEGER AS command_amount, |
This file contains hidden or 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
| CREATE TEMP TABLE raw_input ( | |
| line TEXT, | |
| line_id SERIAL PRIMARY KEY | |
| ); | |
| \COPY raw_input (line) FROM ~/Downloads/input11.txt | |
| CREATE TEMP TABLE seats AS | |
| SELECT *, | |
| row_number() OVER (PARTITION BY row_id) AS column_id |
NewerOlder