From f0355a87c03eb8333a9eaf59a207f1e0eeb7e6aa Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:05:04 +0000 Subject: [PATCH 01/72] first attempt at a github actions file --- .github/workflows/ci.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..339b2246d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,16 @@ +name: CI +on: + [push] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install npm dependencies + run: | + npm install + npm build prod + From b7b6c8c6c295ac06fb24785e49221d3c2e294a7c Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:12:43 +0000 Subject: [PATCH 02/72] fix indenting --- .github/workflows/ci.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 339b2246d..18fea8395 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,16 +1,14 @@ name: CI -on: - [push] +on: [push] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '16' + - uses: actions/setup-node@v3 + with: + node-version: '16' - name: Install npm dependencies run: | npm install npm build prod - From 0cc4e73ec50b3bb3d7e5c7a909faee2d081c36f9 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:20:33 +0000 Subject: [PATCH 03/72] test change to file to trigger a workflow --- .env | 2 +- .github/workflows/ci.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.env b/.env index f7515d09b..9a1442316 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ # Uncomment this to disable running the front-end tooling in Docker. -# FRONTEND=local \ No newline at end of file +FRONTEND=local diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18fea8395..8fa510dc4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,3 +12,4 @@ jobs: run: | npm install npm build prod + npm run lint:css From 1360a8a4f123598d17fb977fb048a09557cfb546 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:22:52 +0000 Subject: [PATCH 04/72] fix indentation --- .github/workflows/ci.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8fa510dc4..58a980898 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,13 +3,13 @@ on: [push] jobs: test: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '16' - - name: Install npm dependencies - run: | - npm install - npm build prod - npm run lint:css + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install npm dependencies + run: | + npm install + npm build prod + npm run lint:css From 05543e1d4fb567d1e362d8c1ae099c37f44001a4 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:24:28 +0000 Subject: [PATCH 05/72] fix npm run build:prod command --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 58a980898..ae09b8e36 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,5 +11,5 @@ jobs: - name: Install npm dependencies run: | npm install - npm build prod + npm build:prod npm run lint:css From 078cc0a7d04a20fba90c68cfd4a8f29c4351198b Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:25:57 +0000 Subject: [PATCH 06/72] fix npm run build:prod command --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ae09b8e36..74ffb273b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,5 +11,5 @@ jobs: - name: Install npm dependencies run: | npm install - npm build:prod + npm run build:prod npm run lint:css From e848d98085e9ad3e9d616f0ad6a93e2247afba5d Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:36:43 +0000 Subject: [PATCH 07/72] add linting --- .github/workflows/ci.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 74ffb273b..9f1b759f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,14 @@ jobs: with: node-version: '16' - name: Install npm dependencies - run: | - npm install - npm run build:prod - npm run lint:css + run: npm install + - name: CSS linting + run: npm run lint:css + - name: JS linting + run: npm run lint:js + - name: Prettier + run: npm run format + - name: JS tests + run: npm run test + - name: Compile static files + run: npm run build:prod From c9d7892a9f66c1f90100afd0801f6978b5c28c3c Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:50:44 +0000 Subject: [PATCH 08/72] start to add some back-end details --- .github/workflows/ci.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9f1b759f5..0f228b9e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,7 @@ name: CI on: [push] jobs: - test: + test-npm: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,3 +20,18 @@ jobs: run: npm run test - name: Compile static files run: npm run build:prod + test-python: + runs-on: ubuntu-latest + env: + SECRET_KEY: testingsecretkey + SECURE_SSL_REDIRECT: false + ALLOWED_HOSTS: localhost + DATABASE_URL: postgres://postgres:postgres@localhost/postgres + BIRDBATH_REQUIRED: false + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 From e0677c22909dbd6ae90404584a5e89db5ad75799 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:57:09 +0000 Subject: [PATCH 09/72] try poetry install --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f228b9e6..dd68cb7ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,3 +35,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 + - uses: Gr1N/setup-poetry@v8 + with: + poetry-version: 1.5.0 + - name: Install Poetry + - run: poetry install --no-ansi From 4c92450a65478f22181208a7b8253de483729c7c Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 11:58:41 +0000 Subject: [PATCH 10/72] syntax fix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd68cb7ab..d7bb7c1e6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,4 +39,4 @@ jobs: with: poetry-version: 1.5.0 - name: Install Poetry - - run: poetry install --no-ansi + run: poetry install --no-ansi From 7f60c89e9c7d85ddec42f7a45047d6d1a452fe6f Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:02:54 +0000 Subject: [PATCH 11/72] add flake8 --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d7bb7c1e6..ad89d6148 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,3 +40,5 @@ jobs: poetry-version: 1.5.0 - name: Install Poetry run: poetry install --no-ansi + - name: Flake8 + run: flake8 From 04ba23c59e4897e69ecba3baa9aedc494ac17128 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:08:27 +0000 Subject: [PATCH 12/72] try isort instead --- .github/workflows/ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ad89d6148..fc8d3c2bd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -40,5 +40,7 @@ jobs: poetry-version: 1.5.0 - name: Install Poetry run: poetry install --no-ansi - - name: Flake8 - run: flake8 + # - name: Flake8 + # run: flake8 + - name: isort + run: isort --check-only --diff rca fabfile.py From eae7dc64b8558a217c79954adce26e88113f38da Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:14:08 +0000 Subject: [PATCH 13/72] see if virtualenvs.create false sorts issues with commands being undefined --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fc8d3c2bd..664f06c68 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,9 @@ jobs: with: poetry-version: 1.5.0 - name: Install Poetry - run: poetry install --no-ansi + run: | + poetry config virtualenvs.create false && + poetry install # - name: Flake8 # run: flake8 - name: isort From 943f6e63fad2a9fbf06e889b6f421a3a137cb363 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:16:19 +0000 Subject: [PATCH 14/72] re-add flake8 and add black --- .github/workflows/ci.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 664f06c68..3ece2db38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,9 @@ jobs: run: | poetry config virtualenvs.create false && poetry install - # - name: Flake8 - # run: flake8 + - name: Flake8 + run: flake8 rca fabfile.py - name: isort run: isort --check-only --diff rca fabfile.py + - name: black + run: black --check rca fabfile.py From 9d0b53d8eb1a45a764e5596fbbeca327fa12ff92 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:18:40 +0000 Subject: [PATCH 15/72] comment out flake8 for now as it is picking up some issues that need fixing --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3ece2db38..77bb47a77 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,8 +42,8 @@ jobs: run: | poetry config virtualenvs.create false && poetry install - - name: Flake8 - run: flake8 rca fabfile.py + # - name: Flake8 + # run: flake8 rca fabfile.py - name: isort run: isort --check-only --diff rca fabfile.py - name: black From dad9a42eb0f5203fd0cfd302f96fe8bbbe469ff3 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:23:06 +0000 Subject: [PATCH 16/72] exclude migrations from black check and try adding more tests --- .github/workflows/ci.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77bb47a77..5df1ba832 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,8 +43,16 @@ jobs: poetry config virtualenvs.create false && poetry install # - name: Flake8 - # run: flake8 rca fabfile.py + # run: flake8 ./rca fabfile.py - name: isort - run: isort --check-only --diff rca fabfile.py + run: isort --check-only --diff ./rca fabfile.py - name: black - run: black --check rca fabfile.py + run: black --check --diff ./rca fabfile.py --exclude migrations/ + - name: collectstatic + run python manage.py collectstatic --verbosity 0 --noinput --clear + - name: System checks + run: python manage.py check + - name: Missing migrations + run: python manage.py makemigrations --check --noinput + - name: Test + run: python manage.py test --settings=rca.settings.test From 10b3c4b4f8f62be51b8c9d3903b1061255108838 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:24:06 +0000 Subject: [PATCH 17/72] syntax fix --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5df1ba832..0f0b746d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,7 @@ jobs: - name: black run: black --check --diff ./rca fabfile.py --exclude migrations/ - name: collectstatic - run python manage.py collectstatic --verbosity 0 --noinput --clear + run: python manage.py collectstatic --verbosity 0 --noinput --clear - name: System checks run: python manage.py check - name: Missing migrations From e96ad60bf872b279952adc157e008753d5303461 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:29:12 +0000 Subject: [PATCH 18/72] go back to one job for now as compilestatic needs the npm tasks --- .github/workflows/ci.yaml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f0b746d7..fc9326ada 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,8 +1,16 @@ name: CI on: [push] jobs: - test-npm: + test: runs-on: ubuntu-latest + + env: + SECRET_KEY: testingsecretkey + SECURE_SSL_REDIRECT: false + ALLOWED_HOSTS: localhost + DATABASE_URL: postgres://postgres:postgres@localhost/postgres + BIRDBATH_REQUIRED: false + steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 @@ -20,17 +28,7 @@ jobs: run: npm run test - name: Compile static files run: npm run build:prod - test-python: - runs-on: ubuntu-latest - env: - SECRET_KEY: testingsecretkey - SECURE_SSL_REDIRECT: false - ALLOWED_HOSTS: localhost - DATABASE_URL: postgres://postgres:postgres@localhost/postgres - BIRDBATH_REQUIRED: false - steps: - - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: From 1ec985407500e76fb374135f34df2e98ac9a6c47 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 12:40:38 +0000 Subject: [PATCH 19/72] tweaking env vars --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fc9326ada..bf412723e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,6 +5,7 @@ jobs: runs-on: ubuntu-latest env: + DJANGO_SETTINGS_MODULE: rca.settings.test SECRET_KEY: testingsecretkey SECURE_SSL_REDIRECT: false ALLOWED_HOSTS: localhost From 44904392767f5620294a335d68935e01730dd181 Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 16:26:04 +0000 Subject: [PATCH 20/72] add postgres service --- .github/workflows/ci.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf412723e..0d15df778 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,6 +12,17 @@ jobs: DATABASE_URL: postgres://postgres:postgres@localhost/postgres BIRDBATH_REQUIRED: false + services: + postgres: + image: postgres:11.5 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 From 879b1b5441b7b408e9085b7c3b97d71972a4228d Mon Sep 17 00:00:00 2001 From: Helen C Date: Fri, 10 Nov 2023 16:39:35 +0000 Subject: [PATCH 21/72] revert .env change --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 9a1442316..5b71bba89 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ # Uncomment this to disable running the front-end tooling in Docker. -FRONTEND=local +# FRONTEND=local From 775008eff8631445b1ec1ee774ae2c6d4aaf557f Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 14:50:51 +0000 Subject: [PATCH 22/72] match the version of postgres used in docker-compose.yml --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0d15df778..c9af36ac8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,5 @@ name: CI -on: [push] +on: push jobs: test: runs-on: ubuntu-latest @@ -14,7 +14,7 @@ jobs: services: postgres: - image: postgres:11.5 + image: postgres:12.3 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres From 44d35989b9a22123290aae26dd30b328bbf2dcc9 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 14:58:26 +0000 Subject: [PATCH 23/72] testing getting value of commit hash --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9af36ac8..77964c859 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,6 @@ name: CI on: push + jobs: test: runs-on: ubuntu-latest @@ -28,6 +29,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: '16' + - name: this is a test + run: echo ${{ github.sha }} - name: Install npm dependencies run: npm install - name: CSS linting From ed557a4da5d5441a167644ea503d37158898d1dd Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:19:28 +0000 Subject: [PATCH 24/72] test reading repo secrets --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77964c859..ed6b420cd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,7 @@ jobs: with: node-version: '16' - name: this is a test - run: echo ${{ github.sha }} + run: echo ${{ secrets.HEROKU_APP_PRODUCTION }} - name: Install npm dependencies run: npm install - name: CSS linting From cfb883c153204bdd4cce441a4e6d56598dfd4066 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:22:17 +0000 Subject: [PATCH 25/72] test reading repo secrets --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed6b420cd..66a6ebdee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,8 @@ jobs: DATABASE_URL: postgres://postgres:postgres@localhost/postgres BIRDBATH_REQUIRED: false + HEROKU_APP: ${{ secrets.HEROKU_APP_PRODUCTION }} + services: postgres: image: postgres:12.3 @@ -30,7 +32,7 @@ jobs: with: node-version: '16' - name: this is a test - run: echo ${{ secrets.HEROKU_APP_PRODUCTION }} + run: echo $HEROKU_APP - name: Install npm dependencies run: npm install - name: CSS linting From 06cd73feda38c8970a1eb1d7444d3f20cea7ae4e Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:26:51 +0000 Subject: [PATCH 26/72] test reading repo secrets --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 66a6ebdee..6c04501ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,8 +12,7 @@ jobs: ALLOWED_HOSTS: localhost DATABASE_URL: postgres://postgres:postgres@localhost/postgres BIRDBATH_REQUIRED: false - - HEROKU_APP: ${{ secrets.HEROKU_APP_PRODUCTION }} + HEROKU_APP: ${{ secrets.HEROKU_APP_NAME_PRODUCTION }} services: postgres: From 931b2a8f028651df5da1ecf65b1215e15489d9bb Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:28:01 +0000 Subject: [PATCH 27/72] remove test --- .github/workflows/ci.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6c04501ed..6134ab477 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,6 @@ jobs: ALLOWED_HOSTS: localhost DATABASE_URL: postgres://postgres:postgres@localhost/postgres BIRDBATH_REQUIRED: false - HEROKU_APP: ${{ secrets.HEROKU_APP_NAME_PRODUCTION }} services: postgres: @@ -30,8 +29,6 @@ jobs: - uses: actions/setup-node@v3 with: node-version: '16' - - name: this is a test - run: echo $HEROKU_APP - name: Install npm dependencies run: npm install - name: CSS linting From 7be2397d7dad9ef95793506ab6e4289ac5aa0b4f Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:33:45 +0000 Subject: [PATCH 28/72] attempt at deployment script in github actions --- .github/workflows/deploy-production.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/deploy-production.yaml diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml new file mode 100644 index 000000000..6d2f1da45 --- /dev/null +++ b/.github/workflows/deploy-production.yaml @@ -0,0 +1,23 @@ +name: production_deployment + +on: + push: + branches: + - main + +jobs: + deploy_production: + runs-on: ubuntu-latest + needs: [test] + + env: + DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY_PRODUCTION }} + HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME_PRODUCTION }} + SHA: ${{ github.sha }} + + steps: + - name: 'deploy master to heroku' + - uses: actions/checkout@v4 + - run: | + echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$r/activity" + curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From c773a3587b5132f4b76f253678007df6e6549974 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:38:18 +0000 Subject: [PATCH 29/72] amend syntax --- .github/workflows/deploy-production.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index 6d2f1da45..720ace74b 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: 'deploy master to heroku' - - uses: actions/checkout@v4 - - run: | + uses: actions/checkout@v4 + run: | echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$r/activity" curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From 6cb66c71c6e53b4c1fe6aee1f81a9ab00a95096b Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 4 Dec 2023 15:40:02 +0000 Subject: [PATCH 30/72] amend syntax --- .github/workflows/deploy-production.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index 720ace74b..e8dc84b37 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -16,8 +16,8 @@ jobs: SHA: ${{ github.sha }} steps: + - uses: actions/checkout@v4 - name: 'deploy master to heroku' - uses: actions/checkout@v4 run: | echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$r/activity" curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From 534ebb0647bbb8f6ce7fa941412eedb2e2faa912 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 09:21:31 +0000 Subject: [PATCH 31/72] couple of fixes to deployment script --- .github/workflows/deploy-production.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index e8dc84b37..671798598 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -3,7 +3,7 @@ name: production_deployment on: push: branches: - - main + - master jobs: deploy_production: @@ -19,5 +19,5 @@ jobs: - uses: actions/checkout@v4 - name: 'deploy master to heroku' run: | - echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$r/activity" + echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From f56ee48e2b4a7c111287f477bb5b34a57c56cbdf Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 09:58:43 +0000 Subject: [PATCH 32/72] experiment with splitting out tasks into callable workflows --- .github/workflows/ci.yaml | 131 +++++++++++++++++++----------------- .github/workflows/lint.yaml | 33 +++++++++ .github/workflows/test.yaml | 54 +++++++++++++++ 3 files changed, 158 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6134ab477..047270878 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,69 +1,80 @@ name: CI + on: push jobs: + lint: + uses: ./.github/workflows/lint.yaml + test: - runs-on: ubuntu-latest + needs: [test] + uses: ./.github/workflows/test.yaml +# name: CI +# on: push + +# jobs: +# test: +# runs-on: ubuntu-latest - env: - DJANGO_SETTINGS_MODULE: rca.settings.test - SECRET_KEY: testingsecretkey - SECURE_SSL_REDIRECT: false - ALLOWED_HOSTS: localhost - DATABASE_URL: postgres://postgres:postgres@localhost/postgres - BIRDBATH_REQUIRED: false +# env: +# DJANGO_SETTINGS_MODULE: rca.settings.test +# SECRET_KEY: testingsecretkey +# SECURE_SSL_REDIRECT: false +# ALLOWED_HOSTS: localhost +# DATABASE_URL: postgres://postgres:postgres@localhost/postgres +# BIRDBATH_REQUIRED: false - services: - postgres: - image: postgres:12.3 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 +# services: +# postgres: +# image: postgres:12.3 +# env: +# POSTGRES_USER: postgres +# POSTGRES_PASSWORD: postgres +# POSTGRES_DB: postgres +# ports: +# - 5432:5432 +# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '16' - - name: Install npm dependencies - run: npm install - - name: CSS linting - run: npm run lint:css - - name: JS linting - run: npm run lint:js - - name: Prettier - run: npm run format - - name: JS tests - run: npm run test - - name: Compile static files - run: npm run build:prod +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v3 +# with: +# node-version: '16' +# - name: Install npm dependencies +# run: npm install +# - name: CSS linting +# run: npm run lint:css +# - name: JS linting +# run: npm run lint:js +# - name: Prettier +# run: npm run format +# - name: JS tests +# run: npm run test +# - name: Compile static files +# run: npm run build:prod - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: 1.5.0 - - name: Install Poetry - run: | - poetry config virtualenvs.create false && - poetry install - # - name: Flake8 - # run: flake8 ./rca fabfile.py - - name: isort - run: isort --check-only --diff ./rca fabfile.py - - name: black - run: black --check --diff ./rca fabfile.py --exclude migrations/ - - name: collectstatic - run: python manage.py collectstatic --verbosity 0 --noinput --clear - - name: System checks - run: python manage.py check - - name: Missing migrations - run: python manage.py makemigrations --check --noinput - - name: Test - run: python manage.py test --settings=rca.settings.test +# - name: Set up Python +# uses: actions/setup-python@v4 +# with: +# python-version: 3.8 +# - uses: Gr1N/setup-poetry@v8 +# with: +# poetry-version: 1.5.0 +# - name: Install Poetry +# run: | +# poetry config virtualenvs.create false && +# poetry install +# # - name: Flake8 +# # run: flake8 ./rca fabfile.py +# - name: isort +# run: isort --check-only --diff ./rca fabfile.py +# - name: black +# run: black --check --diff ./rca fabfile.py --exclude migrations/ +# - name: collectstatic +# run: python manage.py collectstatic --verbosity 0 --noinput --clear +# - name: System checks +# run: python manage.py check +# - name: Missing migrations +# run: python manage.py makemigrations --check --noinput +# - name: Test +# run: python manage.py test --settings=rca.settings.test diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 000000000..d19edc377 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,33 @@ +name: lint + +on: + workflow_call + +jobs: + lint-front-end: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install npm dependencies + run: npm install + - name: CSS linting + run: npm run lint:css + - name: JS linting + run: npm run lint:js + - name: Prettier + run: npm run format + - name: JS tests + run: npm run test + + lint-python: + runs-on: ubuntu-latest + steps: + # - name: Flake8 + # run: flake8 ./rca fabfile.py + - name: isort + run: isort --check-only --diff ./rca fabfile.py + - name: black + run: black --check --diff ./rca fabfile.py --exclude migrations/ diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..a2aec5cac --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,54 @@ +Name: test + +on: workflow_call + +jobs: + python-tests: + runs-on: ubuntu-latest + + env: + DJANGO_SETTINGS_MODULE: rca.settings.test + SECRET_KEY: testingsecretkey + SECURE_SSL_REDIRECT: false + ALLOWED_HOSTS: localhost + DATABASE_URL: postgres://postgres:postgres@localhost/postgres + BIRDBATH_REQUIRED: false + + services: + postgres: + image: postgres:12.3 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - uses: Gr1N/setup-poetry@v8 + with: + poetry-version: 1.5.0 + - name: Install Poetry + run: | + poetry config virtualenvs.create false && + poetry install + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install npm dependencies + run: npm install + - name: Compile static files + run: npm run build:prod + - name: collectstatic + run: python manage.py collectstatic --verbosity 0 --noinput --clear + - name: System checks + run: python manage.py check + - name: Missing migrations + run: python manage.py makemigrations --check --noinput + - name: Test + run: python manage.py test --settings=rca.settings.test From 9f4b3d7c10d365283cb579284158c40cb27caa9a Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:03:29 +0000 Subject: [PATCH 33/72] sort syntax issues --- .github/workflows/ci.yaml | 2 +- .github/workflows/lint.yaml | 47 ++++++++++++++++++------------------- .github/workflows/test.yaml | 4 ++-- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 047270878..acf64990e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: uses: ./.github/workflows/lint.yaml test: - needs: [test] + needs: [lint] uses: ./.github/workflows/test.yaml # name: CI # on: push diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d19edc377..e45575dfe 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,33 +1,32 @@ name: lint -on: - workflow_call +on: workflow_call jobs: lint-front-end: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '16' - - name: Install npm dependencies - run: npm install - - name: CSS linting - run: npm run lint:css - - name: JS linting - run: npm run lint:js - - name: Prettier - run: npm run format - - name: JS tests - run: npm run test + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Install npm dependencies + run: npm install + - name: CSS linting + run: npm run lint:css + - name: JS linting + run: npm run lint:js + - name: Prettier + run: npm run format + - name: JS tests + run: npm run test lint-python: runs-on: ubuntu-latest - steps: - # - name: Flake8 - # run: flake8 ./rca fabfile.py - - name: isort - run: isort --check-only --diff ./rca fabfile.py - - name: black - run: black --check --diff ./rca fabfile.py --exclude migrations/ + steps: + # - name: Flake8 + # run: flake8 ./rca fabfile.py + - name: isort + run: isort --check-only --diff ./rca fabfile.py + - name: black + run: black --check --diff ./rca fabfile.py --exclude migrations/ diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a2aec5cac..36d11414b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -38,8 +38,8 @@ jobs: poetry config virtualenvs.create false && poetry install - uses: actions/setup-node@v3 - with: - node-version: '16' + with: + node-version: '16' - name: Install npm dependencies run: npm install - name: Compile static files From f1486ef544474a26964c18d265669b834d0857ae Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:05:59 +0000 Subject: [PATCH 34/72] another go at sorting syntax issues --- .github/workflows/ci.yaml | 1 - .github/workflows/test.yaml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index acf64990e..fa5a7472b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,6 @@ jobs: uses: ./.github/workflows/lint.yaml test: - needs: [lint] uses: ./.github/workflows/test.yaml # name: CI # on: push diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 36d11414b..bf11b04fe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,6 +5,7 @@ on: workflow_call jobs: python-tests: runs-on: ubuntu-latest + needs: lint env: DJANGO_SETTINGS_MODULE: rca.settings.test From 92724234d699cee8428caf19023e8cab42833a81 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:09:20 +0000 Subject: [PATCH 35/72] see if it is the test call that is throwing the syntax error --- .github/workflows/ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa5a7472b..db7201add 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,9 +5,8 @@ on: push jobs: lint: uses: ./.github/workflows/lint.yaml - - test: - uses: ./.github/workflows/test.yaml + # test: + # uses: ./.github/workflows/test.yaml # name: CI # on: push From fb2d0cbb5f65433fbd6b17a4d93a4db78b3cb43d Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:10:57 +0000 Subject: [PATCH 36/72] fix the lint script --- .github/workflows/lint.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e45575dfe..0a2f22eb8 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,6 +24,17 @@ jobs: lint-python: runs-on: ubuntu-latest steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - uses: Gr1N/setup-poetry@v8 + with: + poetry-version: 1.5.0 + - name: Install Poetry + run: | + poetry config virtualenvs.create false && + poetry install # - name: Flake8 # run: flake8 ./rca fabfile.py - name: isort From 3710f64471785b5d46bd04f0187a650cd6f22cf2 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:16:54 +0000 Subject: [PATCH 37/72] see if it is the option breaking test --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/test.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index db7201add..f7cb997c6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,8 +5,8 @@ on: push jobs: lint: uses: ./.github/workflows/lint.yaml - # test: - # uses: ./.github/workflows/test.yaml + test: + uses: ./.github/workflows/test.yaml # name: CI # on: push diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf11b04fe..f3dd98e6b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,7 +5,7 @@ on: workflow_call jobs: python-tests: runs-on: ubuntu-latest - needs: lint + #needs: lint env: DJANGO_SETTINGS_MODULE: rca.settings.test From b6145b9e472e860e9e0feaac40084e5e71cdd78c Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:18:25 +0000 Subject: [PATCH 38/72] remove commented code --- .github/workflows/ci.yaml | 70 +-------------------------------------- 1 file changed, 1 insertion(+), 69 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7cb997c6..20912ceae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,74 +5,6 @@ on: push jobs: lint: uses: ./.github/workflows/lint.yaml + test: uses: ./.github/workflows/test.yaml -# name: CI -# on: push - -# jobs: -# test: -# runs-on: ubuntu-latest - -# env: -# DJANGO_SETTINGS_MODULE: rca.settings.test -# SECRET_KEY: testingsecretkey -# SECURE_SSL_REDIRECT: false -# ALLOWED_HOSTS: localhost -# DATABASE_URL: postgres://postgres:postgres@localhost/postgres -# BIRDBATH_REQUIRED: false - -# services: -# postgres: -# image: postgres:12.3 -# env: -# POSTGRES_USER: postgres -# POSTGRES_PASSWORD: postgres -# POSTGRES_DB: postgres -# ports: -# - 5432:5432 -# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-node@v3 -# with: -# node-version: '16' -# - name: Install npm dependencies -# run: npm install -# - name: CSS linting -# run: npm run lint:css -# - name: JS linting -# run: npm run lint:js -# - name: Prettier -# run: npm run format -# - name: JS tests -# run: npm run test -# - name: Compile static files -# run: npm run build:prod - -# - name: Set up Python -# uses: actions/setup-python@v4 -# with: -# python-version: 3.8 -# - uses: Gr1N/setup-poetry@v8 -# with: -# poetry-version: 1.5.0 -# - name: Install Poetry -# run: | -# poetry config virtualenvs.create false && -# poetry install -# # - name: Flake8 -# # run: flake8 ./rca fabfile.py -# - name: isort -# run: isort --check-only --diff ./rca fabfile.py -# - name: black -# run: black --check --diff ./rca fabfile.py --exclude migrations/ -# - name: collectstatic -# run: python manage.py collectstatic --verbosity 0 --noinput --clear -# - name: System checks -# run: python manage.py check -# - name: Missing migrations -# run: python manage.py makemigrations --check --noinput -# - name: Test -# run: python manage.py test --settings=rca.settings.test From ff054ff09e75674ad6e670e9def48a6bd5276b52 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:19:27 +0000 Subject: [PATCH 39/72] correct Name value --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f3dd98e6b..c069a20f2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,11 +1,11 @@ -Name: test +name: test on: workflow_call jobs: python-tests: runs-on: ubuntu-latest - #needs: lint + needs: lint env: DJANGO_SETTINGS_MODULE: rca.settings.test From 2b2fcf91b06d7dbe9d0d4a9f251127f7f836e95e Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:20:06 +0000 Subject: [PATCH 40/72] remove dependencies --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c069a20f2..8e60f7a9e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,7 +5,7 @@ on: workflow_call jobs: python-tests: runs-on: ubuntu-latest - needs: lint + #needs: lint env: DJANGO_SETTINGS_MODULE: rca.settings.test From a961060477f350926a7c60480d322fd4a39f7381 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:23:42 +0000 Subject: [PATCH 41/72] add checkout --- .github/workflows/lint.yaml | 1 + .github/workflows/test.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0a2f22eb8..a9fd5019a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,6 +24,7 @@ jobs: lint-python: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8e60f7a9e..ddf0a3d42 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,7 +5,6 @@ on: workflow_call jobs: python-tests: runs-on: ubuntu-latest - #needs: lint env: DJANGO_SETTINGS_MODULE: rca.settings.test @@ -27,6 +26,7 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: From eee3bd9009d9f4cd2040a94487c99b19b1435f11 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:39:25 +0000 Subject: [PATCH 42/72] Move prod deployment to a workflow call --- .github/workflows/ci.yaml | 5 +++++ .github/workflows/deploy-production.yaml | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 20912ceae..859ec6a70 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,3 +8,8 @@ jobs: test: uses: ./.github/workflows/test.yaml + + deploy: + if: contains(github.ref, 'master') + needs: [lint, test] + uses: ./.github/workflows/deploy-production.yaml diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index 671798598..f63c7f1f9 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -1,9 +1,6 @@ name: production_deployment -on: - push: - branches: - - master +on: workflow_call jobs: deploy_production: From dfded9c251a838987c79588019e40ff7a824effc Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:41:02 +0000 Subject: [PATCH 43/72] remove dependency from deploy-production --- .github/workflows/deploy-production.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index f63c7f1f9..4e98dab5b 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -5,7 +5,6 @@ on: workflow_call jobs: deploy_production: runs-on: ubuntu-latest - needs: [test] env: DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY_PRODUCTION }} From a02ea4724ec897a14e644bade9435756ca602a50 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:46:19 +0000 Subject: [PATCH 44/72] make sure that the test to run the production deployment won't run on another branch with a harmless test --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 859ec6a70..5eee419b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,4 +12,7 @@ jobs: deploy: if: contains(github.ref, 'master') needs: [lint, test] - uses: ./.github/workflows/deploy-production.yaml + # uses: ./.github/workflows/deploy-production.yaml + steps: + name: test-job: + run: echo: 'hello' From 063269d9b444ba007802aa256b639093854eeb63 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:47:26 +0000 Subject: [PATCH 45/72] syntax --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5eee419b1..b700fafc2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,5 +14,5 @@ jobs: needs: [lint, test] # uses: ./.github/workflows/deploy-production.yaml steps: - name: test-job: - run: echo: 'hello' + - name: test-job: + run: echo: 'hello' From 679bcb03ca1321ff91d04af3b9d23e6509ff66aa Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:48:06 +0000 Subject: [PATCH 46/72] syntax --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b700fafc2..f19ce13fd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,5 +14,5 @@ jobs: needs: [lint, test] # uses: ./.github/workflows/deploy-production.yaml steps: - - name: test-job: + - name: test-job run: echo: 'hello' From 8fdcecdfb316cdcfa2e68e5ee6568a9f27ebb6d6 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:48:43 +0000 Subject: [PATCH 47/72] syntax --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f19ce13fd..3bca698ba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,4 +15,4 @@ jobs: # uses: ./.github/workflows/deploy-production.yaml steps: - name: test-job - run: echo: 'hello' + run: echo 'hello' From 1fb260da9e937c31f3f95d16d972a3f4b1f2eee0 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:49:22 +0000 Subject: [PATCH 48/72] syntax arg --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3bca698ba..dbc5fb1c0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,7 @@ jobs: if: contains(github.ref, 'master') needs: [lint, test] # uses: ./.github/workflows/deploy-production.yaml + runs-on: ubuntu-latest steps: - name: test-job run: echo 'hello' From 0320142c4311b96d720b804b2c4a11d5e3a50692 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:57:39 +0000 Subject: [PATCH 49/72] Add deployment scripts for dev and staging, and test out running the dev one from this branch --- .github/workflows/ci.yaml | 22 +++++++++++++++++----- .github/workflows/deploy-dev.yaml | 19 +++++++++++++++++++ .github/workflows/deploy-staging.yaml | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/deploy-dev.yaml create mode 100644 .github/workflows/deploy-staging.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbc5fb1c0..a8bc234e5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,8 +12,20 @@ jobs: deploy: if: contains(github.ref, 'master') needs: [lint, test] - # uses: ./.github/workflows/deploy-production.yaml - runs-on: ubuntu-latest - steps: - - name: test-job - run: echo 'hello' + uses: ./.github/workflows/deploy-production.yaml + + deploy: + if: contains(github.ref, 'dev') + needs: [lint, test] + uses: ./.github/workflows/deploy-dev.yaml + + deploy: + if: contains(github.ref, 'staging') + needs: [lint, test] + uses: ./.github/workflows/deploy-staging.yaml + + # this is to test a deployment script + deploy: + if: contains(github.ref, 'chore/github-actions') + needs: [lint, test] + uses: ./.github/workflows/deploy-dev.yaml diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml new file mode 100644 index 000000000..c24bec46c --- /dev/null +++ b/.github/workflows/deploy-dev.yaml @@ -0,0 +1,19 @@ +name: dev_deployment + +on: workflow_call + +jobs: + deploy_dev: + runs-on: ubuntu-latest + + env: + DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY_DEV }} + HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME_DEV }} + SHA: ${{ github.sha }} + + steps: + - uses: actions/checkout@v4 + - name: 'deploy master to heroku' + run: | + echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" + curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml new file mode 100644 index 000000000..fd82be754 --- /dev/null +++ b/.github/workflows/deploy-staging.yaml @@ -0,0 +1,19 @@ +name: staging_deployment + +on: workflow_call + +jobs: + deploy_staging: + runs-on: ubuntu-latest + + env: + DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY_STAGING }} + HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME_STAGING }} + SHA: ${{ github.sha }} + + steps: + - uses: actions/checkout@v4 + - name: 'deploy master to heroku' + run: | + echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" + curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From 609458b63a258b1ac5a4597acad4b72f00801480 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 10:58:24 +0000 Subject: [PATCH 50/72] Add deployment scripts for dev and staging, and test out running the dev one from this branch --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a8bc234e5..94f5fe9f1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,23 +9,23 @@ jobs: test: uses: ./.github/workflows/test.yaml - deploy: + deploy_production: if: contains(github.ref, 'master') needs: [lint, test] uses: ./.github/workflows/deploy-production.yaml - deploy: + deploy_dev: if: contains(github.ref, 'dev') needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml - deploy: + deploy_staging: if: contains(github.ref, 'staging') needs: [lint, test] uses: ./.github/workflows/deploy-staging.yaml # this is to test a deployment script - deploy: + deploy_test: if: contains(github.ref, 'chore/github-actions') needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml From 77d41435c8a9e2943bae6a9dafef5e211c7b9c0e Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:10:07 +0000 Subject: [PATCH 51/72] testing passing secrets to called workflows --- .github/workflows/ci.yaml | 37 +++++++++++++++------------ .github/workflows/deploy-dev.yaml | 15 +++++++---- .github/workflows/deploy-staging.yaml | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 94f5fe9f1..c83b67b29 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,29 +3,32 @@ name: CI on: push jobs: - lint: - uses: ./.github/workflows/lint.yaml + # lint: + # uses: ./.github/workflows/lint.yaml - test: - uses: ./.github/workflows/test.yaml + # test: + # uses: ./.github/workflows/test.yaml - deploy_production: - if: contains(github.ref, 'master') - needs: [lint, test] - uses: ./.github/workflows/deploy-production.yaml + # deploy_production: + # if: contains(github.ref, 'master') + # needs: [lint, test] + # uses: ./.github/workflows/deploy-production.yaml - deploy_dev: - if: contains(github.ref, 'dev') - needs: [lint, test] - uses: ./.github/workflows/deploy-dev.yaml + # deploy_dev: + # if: contains(github.ref, 'dev') + # needs: [lint, test] + # uses: ./.github/workflows/deploy-dev.yaml - deploy_staging: - if: contains(github.ref, 'staging') - needs: [lint, test] - uses: ./.github/workflows/deploy-staging.yaml + # deploy_staging: + # if: contains(github.ref, 'staging') + # needs: [lint, test] + # uses: ./.github/workflows/deploy-staging.yaml # this is to test a deployment script deploy_test: if: contains(github.ref, 'chore/github-actions') - needs: [lint, test] + #needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml + secrets: + DEPLOYMENT_KEY_DEV: ${{ secrets.DEPLOYMENT_KEY_DEV }} + HEROKU_APP_NAME_DEV: ${{ secrets.HEROKU_APP_NAME_DEV }} diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index c24bec46c..5599856b2 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -1,6 +1,9 @@ name: dev_deployment -on: workflow_call +on: workflow_call: + secrets: + token: + required: true jobs: deploy_dev: @@ -13,7 +16,9 @@ jobs: steps: - uses: actions/checkout@v4 - - name: 'deploy master to heroku' - run: | - echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" - curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" + - name: test secrets + run: echo $HEROKU_APP_NAME + # - name: 'deploy dev to heroku' + # run: | + # echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" + # curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index fd82be754..8d5ae37cd 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: 'deploy master to heroku' + - name: 'deploy staging to heroku' run: | echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From e6fce7e6cf28bd2fd27bbb35f8c7d3c03f85f516 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:11:02 +0000 Subject: [PATCH 52/72] testing passing secrets to called workflows --- .github/workflows/deploy-dev.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 5599856b2..70add6cdf 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -1,9 +1,10 @@ name: dev_deployment -on: workflow_call: - secrets: - token: - required: true +on: + workflow_call: + secrets: + token: + required: true jobs: deploy_dev: From 304edfa62ae896865450aec77f5b3650b6148da1 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:15:43 +0000 Subject: [PATCH 53/72] testing passing secrets to called workflows --- .github/workflows/ci.yaml | 2 ++ .github/workflows/deploy-dev.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c83b67b29..33f42e8aa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,6 +29,8 @@ jobs: if: contains(github.ref, 'chore/github-actions') #needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml + with: + test: 'test' secrets: DEPLOYMENT_KEY_DEV: ${{ secrets.DEPLOYMENT_KEY_DEV }} HEROKU_APP_NAME_DEV: ${{ secrets.HEROKU_APP_NAME_DEV }} diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 70add6cdf..6ea2aef08 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -2,6 +2,8 @@ name: dev_deployment on: workflow_call: + inputs: + test: string secrets: token: required: true From 7137ac2df5f862cd770e5354a2a6f6d70b564247 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:17:47 +0000 Subject: [PATCH 54/72] testing passing secrets to called workflows --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 33f42e8aa..593fc3c59 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,7 @@ jobs: #needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml with: - test: 'test' + test-input: 'test' secrets: DEPLOYMENT_KEY_DEV: ${{ secrets.DEPLOYMENT_KEY_DEV }} HEROKU_APP_NAME_DEV: ${{ secrets.HEROKU_APP_NAME_DEV }} From 4444e4f5ddb8eb3ab727801c2d83f8da04ddd125 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:18:23 +0000 Subject: [PATCH 55/72] testing passing secrets to called workflows --- .github/workflows/deploy-dev.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 6ea2aef08..9a018200b 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -3,7 +3,9 @@ name: dev_deployment on: workflow_call: inputs: - test: string + test-input: + required: true + type: string secrets: token: required: true From f4718c59c842f1cdaaed0809a002e9babaa9540f Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:20:27 +0000 Subject: [PATCH 56/72] testing passing secrets to called workflows --- .github/workflows/deploy-dev.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 9a018200b..f13dae540 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -7,7 +7,9 @@ on: required: true type: string secrets: - token: + DEPLOYMENT_KEY_DEV: + required: true + HEROKU_APP_NAME_DEV: required: true jobs: From 32c66eb6b40f9fcfca30f4276314b8f1b9925c74 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:27:33 +0000 Subject: [PATCH 57/72] testing passing secrets to called workflows --- .github/workflows/ci.yaml | 6 +----- .github/workflows/deploy-dev.yaml | 12 +----------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 593fc3c59..1cf3f6e1a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,8 +29,4 @@ jobs: if: contains(github.ref, 'chore/github-actions') #needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml - with: - test-input: 'test' - secrets: - DEPLOYMENT_KEY_DEV: ${{ secrets.DEPLOYMENT_KEY_DEV }} - HEROKU_APP_NAME_DEV: ${{ secrets.HEROKU_APP_NAME_DEV }} + secrets: inherit diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index f13dae540..7b246dbb1 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -1,16 +1,6 @@ name: dev_deployment -on: - workflow_call: - inputs: - test-input: - required: true - type: string - secrets: - DEPLOYMENT_KEY_DEV: - required: true - HEROKU_APP_NAME_DEV: - required: true +on: workflow_call jobs: deploy_dev: From 7a731c69436fcdb84d8800bd08fcf4bcdea2d90a Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:28:49 +0000 Subject: [PATCH 58/72] test dev deployment from this branch --- .github/workflows/deploy-dev.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 7b246dbb1..a9468901b 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -13,9 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: test secrets - run: echo $HEROKU_APP_NAME - # - name: 'deploy dev to heroku' - # run: | - # echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" - # curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" + - name: 'deploy dev to heroku' + run: | + echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity" + curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0" From 2686ea832d656ed9cff94e02aabcc1a798555637 Mon Sep 17 00:00:00 2001 From: Helen C Date: Tue, 5 Dec 2023 11:37:19 +0000 Subject: [PATCH 59/72] remove test --- .github/workflows/ci.yaml | 40 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1cf3f6e1a..b77c1529e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,30 +3,26 @@ name: CI on: push jobs: - # lint: - # uses: ./.github/workflows/lint.yaml + lint: + uses: ./.github/workflows/lint.yaml - # test: - # uses: ./.github/workflows/test.yaml + test: + uses: ./.github/workflows/test.yaml - # deploy_production: - # if: contains(github.ref, 'master') - # needs: [lint, test] - # uses: ./.github/workflows/deploy-production.yaml - - # deploy_dev: - # if: contains(github.ref, 'dev') - # needs: [lint, test] - # uses: ./.github/workflows/deploy-dev.yaml - - # deploy_staging: - # if: contains(github.ref, 'staging') - # needs: [lint, test] - # uses: ./.github/workflows/deploy-staging.yaml + deploy_production: + if: contains(github.ref, 'master') + needs: [lint, test] + uses: ./.github/workflows/deploy-production.yaml + secrets: inherit - # this is to test a deployment script - deploy_test: - if: contains(github.ref, 'chore/github-actions') - #needs: [lint, test] + deploy_dev: + if: contains(github.ref, 'dev') + needs: [lint, test] uses: ./.github/workflows/deploy-dev.yaml secrets: inherit + + deploy_staging: + if: contains(github.ref, 'staging') + needs: [lint, test] + uses: ./.github/workflows/deploy-staging.yaml + secrets: inherit From 73718497890769aebac6edf0c31e63f21fe872ac Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 19:11:22 +0000 Subject: [PATCH 60/72] amend when ci runs --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b77c1529e..75d28802a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,9 @@ name: CI -on: push +on: + pull_request: + push: + branches: [dev, staging, master] jobs: lint: From 1d7aaf0d53521df31cfd9591667495178ca1e6bf Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 19:25:31 +0000 Subject: [PATCH 61/72] Remove circle ci and gitlab ci files, and update docs --- .circleci/config.yml | 136 ------------------------ .gitlab-ci.yml | 247 ------------------------------------------- Dockerfile | 1 + README.md | 8 +- 4 files changed, 4 insertions(+), 388 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .gitlab-ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 93c803f55..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,136 +0,0 @@ -version: 2 -jobs: - test: - docker: - - image: circleci/python:3.8-buster-node - environment: - SECRET_KEY: testingsecretkey - SECURE_SSL_REDIRECT: false - ALLOWED_HOSTS: localhost - DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable - BIRDBATH_REQUIRED: false - - image: cimg/postgres:15.5 # Latest patch version at the time of writing - environment: - POSTGRES_USER: root - POSTGRES_DB: circle_test - POSTGRES_HOST_AUTH_METHOD: trust - working_directory: ~/repo - steps: - - checkout - - restore_cache: - keys: - - dependencies-{{checksum "poetry.lock"}} - - run: - name: install python dependencies - command: | - curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.2 python3 - - python -m venv venv - . ./venv/bin/activate - poetry install --no-ansi - - save_cache: - paths: - - ./venv - key: dependencies-{{checksum "poetry.lock"}} - - run: - name: install node dependencies - command: | - npm ci - - run: - name: Linting js - command: | - npm run lint:js - - run: - name: Linting css - command: | - npm run lint:css - - run: - name: Linting format - command: | - npm run lint:format - - run: - name: Front end tests - command: | - npm run test:coverage - - run: - name: compile static assets - command: | - npm run build:prod - - run: - name: Run Django tests - command: | - . venv/bin/activate - pip install coverage - isort --check-only --diff ./rca --skip-glob '**/migrations/*' - ./manage.py collectstatic --verbosity 0 --noinput --clear - ./manage.py makemigrations --check --noinput - ./manage.py check - coverage run ./manage.py test --settings=rca.settings.test - coverage report - coverage xml - bash <(curl -s https://codecov.io/bash) -t $COVERAGE_TOKEN - - run: - name: Run Black - command: | - . venv/bin/activate - black --check --diff ./rca --exclude migrations/ - deploy_dev: - docker: - - image: buildpack-deps:trusty - steps: - - checkout - - run: - name: deploy dev to heroku - command: | - echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME_DEV/activity" - curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME_DEV/$CIRCLE_SHA1?key=$DEPLOYMENT_KEY -d "Content-Length: 0" - deploy_staging: - docker: - - image: buildpack-deps:trusty - steps: - - checkout - - run: - name: deploy staging to heroku - command: | - echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME_STAGING/activity" - curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME_STAGING/$CIRCLE_SHA1?key=$DEPLOYMENT_KEY -d "Content-Length: 0" - deploy_production: - docker: - - image: buildpack-deps:trusty - steps: - - checkout - - run: - name: deploy master to heroku - command: | - echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME_PRODUCTION/activity" - curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME_PRODUCTION/$CIRCLE_SHA1?key=$DEPLOYMENT_KEY -d "Content-Length: 0" -workflows: - version: 2 - build-deploy: - jobs: - - test - - deploy_dev: - requires: - - test - filters: - branches: - only: dev - - deploy_staging: - requires: - - test - filters: - branches: - only: staging - - confirm_deploy_production: - type: approval - requires: - - test - filters: - branches: - only: master - - deploy_production: - requires: - - test - - confirm_deploy_production - filters: - branches: - only: master diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 90aa52b42..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,247 +0,0 @@ -# vim:set sw=2 ts=2 et: -# This is a sample .gitlab-ci.yml created by wagtail-kit. You should review -# it for any necessary changes. - -# Stages are groups that jobs can be groupped into. -# Jobs within each stage run in parallel and if one of them fails, the next -# stage won't be run. -# This will set up the following: -# -# - Build stage: build of static assets. -# - Test stage: code style, migration, basic configuration checks and unit -# tests. -# - Deploy stage: deploy to Heroku. -stages: - - build - - test - - deploy - -# Test if static assets can be built succesfully. -static: - image: node:12-alpine - stage: build - before_script: - - apk add --no-cache rsync - script: - # Make sure your project has a package-lock.json lockfile, otherwise this install will fail. - - npm ci - - npm run build:prod - # Saving the job result as an artifact means that the files can be used by - # other jobs. - artifacts: - name: 'static-$CI_JOB_ID' - paths: - - ./node_modules - - ./rca/static_compiled - expire_in: 1 week - -# Check python code style. -flake8: - image: python:3.6 - stage: test - script: - # Remember to update a version in requirements-dev.txt - - pip install flake8==3.7.7 - - flake8 rca - -# Check imports sort order, i.e. check whether they are in an alphabetical -# order and grouped properly. -isort: - image: python:3.6 - stage: test - before_script: - # Remember to update a version in requirements-dev.txt - - pip install isort==4.3.15 - script: - - isort --check-only --diff rca - -lint_js: - image: node:12-alpine - stage: test - dependencies: - - static - script: - - npm run lint:js - -lint_css: - image: node:12-alpine - stage: test - dependencies: - - static - script: - - npm run lint:css - -lint_format: - image: node:12-alpine - stage: test - dependencies: - - static - script: - - npm run lint:format - -# Run black and check for changes -black: - image: python:3.7 - stage: test - before_script: - # Remember to update a version in requirements-dev.txt - - pip install black==19.3b0 - script: - - black --check ./ - -# Check settings, migrations and run tests. -test_python: - # Make sure this Python version matches the version in your Dockerfile. - image: python:3.6.6 - stage: test - services: - # Make sure this matches the Postgres version you run on your servers. - - postgres:15 - dependencies: - - static - variables: - # Run tests with the production settings. - DJANGO_SETTINGS_MODULE: rca.settings.production - - # SECRET_KEY is required by Django to start. - SECRET_KEY: fake_secret_key_to_run_tests - - # Silence RECAPTCHA - RECAPTCHA_PUBLIC_KEY: 'dummy-key-value' - RECAPTCHA_PRIVATE_KEY: 'dummy-key-value' - - # This is the URL used by databases on our CI. - DATABASE_URL: postgres://postgres@postgres/postgres - - # Don't redirect to HTTPS in tests. - SECURE_SSL_REDIRECT: 'false' - before_script: - # Install requirements - - pip install wheel - - pip install -r requirements.txt - script: - # We need to run the collectstatic command, because we use ManifestStaticFilesStorage. - # Otherwise the check command will fail - - python manage.py collectstatic --verbosity 0 --noinput --clear - - # Run system checks - - python manage.py check - - # Check for missing migrations - - python manage.py makemigrations --check --noinput - - # Create cache table. - - python manage.py createcachetable - - # Run back-end tests - - python manage.py test - -test_js: - image: node:12-alpine - stage: test - dependencies: - - static - script: - # Run front-end tests - - npm run test:coverage - -.heroku_deploy_job_template: &heroku_deploy_job_definition - before_script: - # Install cURL and GnuPG to install Heroku CLI. - # Install Git to push the code to Heroku. It uses HTTP to push the code. - - apt-get update -y - - apt-get install -y curl git gnupg - - # Install Heroku CLI. - - curl https://cli-assets.heroku.com/install-ubuntu.sh | sh - - # Use Heroku credentials that you can add in your project settings on - # GitLab. They can be obtained from sysadmin or pwman. - - | - cat >~/.netrc <~/.netrc < Date: Mon, 18 Dec 2023 19:42:16 +0000 Subject: [PATCH 62/72] try a coverage test --- .github/workflows/test.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ddf0a3d42..a32c6a930 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -53,3 +53,8 @@ jobs: run: python manage.py makemigrations --check --noinput - name: Test run: python manage.py test --settings=rca.settings.test + - name: Coverage + uses: actions/python-django-coverage-gitHub-action@0.9 + with: + django-app: 'rca' + minimum-coverage: '86' From 28a1b7a44bf8c02f6e9c4f2564eb1d9dd3379244 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 19:43:43 +0000 Subject: [PATCH 63/72] syntax fix --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a32c6a930..d4e16a517 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -55,6 +55,6 @@ jobs: run: python manage.py test --settings=rca.settings.test - name: Coverage uses: actions/python-django-coverage-gitHub-action@0.9 - with: - django-app: 'rca' - minimum-coverage: '86' + with: + django-app: 'rca' + minimum-coverage: '86' From 0deb374cd6593d04c58e9f80bee87f5b0d54b4e1 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 19:49:53 +0000 Subject: [PATCH 64/72] run coverage in a script --- .github/workflows/test.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d4e16a517..792a7d7c0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -54,7 +54,8 @@ jobs: - name: Test run: python manage.py test --settings=rca.settings.test - name: Coverage - uses: actions/python-django-coverage-gitHub-action@0.9 - with: - django-app: 'rca' - minimum-coverage: '86' + run: | + coverage run ./manage.py test --settings=rca.settings.test + coverage report + coverage xml + bash <(curl -s https://codecov.io/bash) -t $COVERAGE_TOKEN From 8043344c455f851371753c9d3964efa0a0be7b84 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 20:02:20 +0000 Subject: [PATCH 65/72] don't run tests twice --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 792a7d7c0..098081e00 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -55,7 +55,6 @@ jobs: run: python manage.py test --settings=rca.settings.test - name: Coverage run: | - coverage run ./manage.py test --settings=rca.settings.test coverage report coverage xml bash <(curl -s https://codecov.io/bash) -t $COVERAGE_TOKEN From 6a581a6b8f6da45896267f11bb804fc067570d23 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 20:07:53 +0000 Subject: [PATCH 66/72] Run tests and coverage together --- .github/workflows/test.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 098081e00..8b7b4ad5d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,10 +51,9 @@ jobs: run: python manage.py check - name: Missing migrations run: python manage.py makemigrations --check --noinput - - name: Test - run: python manage.py test --settings=rca.settings.test - - name: Coverage + - name: Test and Coverage run: | + coverage run ./manage.py test --settings=rca.settings.test coverage report coverage xml bash <(curl -s https://codecov.io/bash) -t $COVERAGE_TOKEN From 5c90e94169d965af8cd4b8262a35c0655a6ba6f7 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 20:16:13 +0000 Subject: [PATCH 67/72] Re-add flake8 check --- .github/workflows/lint.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a9fd5019a..7e3ad660e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -36,8 +36,8 @@ jobs: run: | poetry config virtualenvs.create false && poetry install - # - name: Flake8 - # run: flake8 ./rca fabfile.py + - name: Flake8 + run: flake8 ./rca fabfile.py - name: isort run: isort --check-only --diff ./rca fabfile.py - name: black From e63fe3beeef473f78a0a62da071dd5f0102f6b84 Mon Sep 17 00:00:00 2001 From: Helen C Date: Mon, 18 Dec 2023 20:18:44 +0000 Subject: [PATCH 68/72] fix flake8 errors --- rca/images/models.py | 1 - rca/people/admin/page_import_forms.py | 1 - 2 files changed, 2 deletions(-) diff --git a/rca/images/models.py b/rca/images/models.py index 93a8250ed..31e878d87 100644 --- a/rca/images/models.py +++ b/rca/images/models.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.db import models from wagtail.api import APIField from wagtail.images.models import AbstractImage, AbstractRendition, Image diff --git a/rca/people/admin/page_import_forms.py b/rca/people/admin/page_import_forms.py index 44bf591a5..e7781dd49 100644 --- a/rca/people/admin/page_import_forms.py +++ b/rca/people/admin/page_import_forms.py @@ -1,5 +1,4 @@ from django import forms -from django.contrib import admin from django.contrib.admin.widgets import AutocompleteSelect from django.contrib.auth import get_user_model from import_export.forms import ConfirmImportForm, ImportForm From 693a4111539f508ed656255c6e0d81c0370e4b62 Mon Sep 17 00:00:00 2001 From: Kevin howbrook Date: Mon, 13 May 2024 12:57:25 +0100 Subject: [PATCH 69/72] Update poetry as per main/pyproject --- .github/workflows/lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 7e3ad660e..2b8f654cc 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -31,7 +31,7 @@ jobs: python-version: 3.8 - uses: Gr1N/setup-poetry@v8 with: - poetry-version: 1.5.0 + poetry-version: 1.8.2 - name: Install Poetry run: | poetry config virtualenvs.create false && From 7370401dcb8af541670842d93d252dfd1ce3c243 Mon Sep 17 00:00:00 2001 From: Kevin howbrook Date: Mon, 13 May 2024 13:02:08 +0100 Subject: [PATCH 70/72] Skip migrations when running isort --- .github/workflows/lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2b8f654cc..21eb69730 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -39,6 +39,6 @@ jobs: - name: Flake8 run: flake8 ./rca fabfile.py - name: isort - run: isort --check-only --diff ./rca fabfile.py + run: isort --check-only --diff ./rca --skip-glob '**/migrations/*' - name: black run: black --check --diff ./rca fabfile.py --exclude migrations/ From 83f00228aca0369d29e582bfa2a746d23aba1c3b Mon Sep 17 00:00:00 2001 From: Kevin howbrook Date: Mon, 13 May 2024 13:20:29 +0100 Subject: [PATCH 71/72] Update docs --- docs/deployment.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 3f55f1260..1fdf4c28f 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -2,13 +2,15 @@ The VM comes preinstalled with Fabric, Heroku CLI and AWS CLI. +Deployments are automatically handled by github actions. + ## Deployed environments -| Environment | Branch | URL | Heroku | -| ---------------------------------- | --------- | ------------------------------------------ | ---------------------- | -| Production | `master` | e.g. https://chi.org | e.g. `chi-production` | -| Staging (considered out of action) | `staging` | e.g. https://chi.staging.torchbox.com | e.g. `chi-staging` | -| Development | `dev` | e.g. https://chi-development.herokuapp.com | e.g. `chi-development` | +| Environment | Branch | URL | Heroku | +| ---------------------------------- | --------- | ----------------------------- | ----------------- | +| Production | `master` | https://rca.ac.uk | `rca-production` | +| Staging (considered out of action) | `staging` | rca-staging.herokuapp.com | `rca-staging` | +| Development | `dev` | rca-development.herokuapp.com | `rca-development` | ## Login to Heroku From 417245fc53ce560cd716516eb24c5d0c34a0b836 Mon Sep 17 00:00:00 2001 From: Kevin howbrook Date: Mon, 13 May 2024 13:20:44 +0100 Subject: [PATCH 72/72] Update docs --- docs/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment.md b/docs/deployment.md index 1fdf4c28f..6eb43f055 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -8,7 +8,7 @@ Deployments are automatically handled by github actions. | Environment | Branch | URL | Heroku | | ---------------------------------- | --------- | ----------------------------- | ----------------- | -| Production | `master` | https://rca.ac.uk | `rca-production` | +| Production | `master` | rca.ac.uk | `rca-production` | | Staging (considered out of action) | `staging` | rca-staging.herokuapp.com | `rca-staging` | | Development | `dev` | rca-development.herokuapp.com | `rca-development` |