Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace circle CI with github actions #962

Merged
merged 72 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f0355a8
first attempt at a github actions file
helenb Nov 10, 2023
b7b6c8c
fix indenting
helenb Nov 10, 2023
0cc4e73
test change to file to trigger a workflow
helenb Nov 10, 2023
1360a8a
fix indentation
helenb Nov 10, 2023
05543e1
fix npm run build:prod command
helenb Nov 10, 2023
078cc0a
fix npm run build:prod command
helenb Nov 10, 2023
e848d98
add linting
helenb Nov 10, 2023
c9d7892
start to add some back-end details
helenb Nov 10, 2023
e0677c2
try poetry install
helenb Nov 10, 2023
4c92450
syntax fix
helenb Nov 10, 2023
7f60c89
add flake8
helenb Nov 10, 2023
04ba23c
try isort instead
helenb Nov 10, 2023
eae7dc6
see if virtualenvs.create false sorts issues with commands being unde…
helenb Nov 10, 2023
943f6e6
re-add flake8 and add black
helenb Nov 10, 2023
9d0b53d
comment out flake8 for now as it is picking up some issues that need …
helenb Nov 10, 2023
dad9a42
exclude migrations from black check and try adding more tests
helenb Nov 10, 2023
10b3c4b
syntax fix
helenb Nov 10, 2023
e96ad60
go back to one job for now as compilestatic needs the npm tasks
helenb Nov 10, 2023
1ec9854
tweaking env vars
helenb Nov 10, 2023
4490439
add postgres service
helenb Nov 10, 2023
879b1b5
revert .env change
helenb Nov 10, 2023
775008e
match the version of postgres used in docker-compose.yml
helenb Dec 4, 2023
44d3598
testing getting value of commit hash
helenb Dec 4, 2023
ed557a4
test reading repo secrets
helenb Dec 4, 2023
cfb883c
test reading repo secrets
helenb Dec 4, 2023
06cd73f
test reading repo secrets
helenb Dec 4, 2023
931b2a8
remove test
helenb Dec 4, 2023
7be2397
attempt at deployment script in github actions
helenb Dec 4, 2023
c773a35
amend syntax
helenb Dec 4, 2023
6cb66c7
amend syntax
helenb Dec 4, 2023
534ebb0
couple of fixes to deployment script
helenb Dec 5, 2023
f56ee48
experiment with splitting out tasks into callable workflows
helenb Dec 5, 2023
9f4b3d7
sort syntax issues
helenb Dec 5, 2023
f1486ef
another go at sorting syntax issues
helenb Dec 5, 2023
9272423
see if it is the test call that is throwing the syntax error
helenb Dec 5, 2023
fb2d0cb
fix the lint script
helenb Dec 5, 2023
3710f64
see if it is the option breaking test
helenb Dec 5, 2023
b6145b9
remove commented code
helenb Dec 5, 2023
ff054ff
correct Name value
helenb Dec 5, 2023
2b2fcf9
remove dependencies
helenb Dec 5, 2023
a961060
add checkout
helenb Dec 5, 2023
eee3bd9
Move prod deployment to a workflow call
helenb Dec 5, 2023
dfded9c
remove dependency from deploy-production
helenb Dec 5, 2023
a02ea47
make sure that the test to run the production deployment won't run on…
helenb Dec 5, 2023
063269d
syntax
helenb Dec 5, 2023
679bcb0
syntax
helenb Dec 5, 2023
8fdcecd
syntax
helenb Dec 5, 2023
1fb260d
syntax arg
helenb Dec 5, 2023
0320142
Add deployment scripts for dev and staging, and test out running the …
helenb Dec 5, 2023
609458b
Add deployment scripts for dev and staging, and test out running the …
helenb Dec 5, 2023
77d4143
testing passing secrets to called workflows
helenb Dec 5, 2023
e6fce7e
testing passing secrets to called workflows
helenb Dec 5, 2023
304edfa
testing passing secrets to called workflows
helenb Dec 5, 2023
7137ac2
testing passing secrets to called workflows
helenb Dec 5, 2023
4444e4f
testing passing secrets to called workflows
helenb Dec 5, 2023
f4718c5
testing passing secrets to called workflows
helenb Dec 5, 2023
32c66eb
testing passing secrets to called workflows
helenb Dec 5, 2023
7a731c6
test dev deployment from this branch
helenb Dec 5, 2023
2686ea8
remove test
helenb Dec 5, 2023
7371849
amend when ci runs
helenb Dec 18, 2023
1d7aaf0
Remove circle ci and gitlab ci files, and update docs
helenb Dec 18, 2023
231249e
try a coverage test
helenb Dec 18, 2023
28a1b7a
syntax fix
helenb Dec 18, 2023
0deb374
run coverage in a script
helenb Dec 18, 2023
8043344
don't run tests twice
helenb Dec 18, 2023
6a581a6
Run tests and coverage together
helenb Dec 18, 2023
5c90e94
Re-add flake8 check
helenb Dec 18, 2023
e63fe3b
fix flake8 errors
helenb Dec 18, 2023
693a411
Update poetry as per main/pyproject
kevinhowbrook May 13, 2024
7370401
Skip migrations when running isort
kevinhowbrook May 13, 2024
83f0022
Update docs
kevinhowbrook May 13, 2024
417245f
Update docs
kevinhowbrook May 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 0 additions & 136 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Uncomment this to disable running the front-end tooling in Docker.
# FRONTEND=local
# FRONTEND=local
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
pull_request:
push:
branches: [dev, staging, master]

jobs:
lint:
uses: ./.github/workflows/lint.yaml

test:
uses: ./.github/workflows/test.yaml

deploy_production:
if: contains(github.ref, 'master')
needs: [lint, test]
uses: ./.github/workflows/deploy-production.yaml
secrets: inherit

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
19 changes: 19 additions & 0 deletions .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
@@ -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 dev to heroku'
run: |
echo "Deploying to Heroku. To see progress, go to: https://dashboard.heroku.com/apps/$HEROKU_APP_NAME/activity"
helenb marked this conversation as resolved.
Show resolved Hide resolved
curl -sf -X POST -m 900 https://heroku-deploy.torchbox.com/$HEROKU_APP_NAME/$SHA?key=$DEPLOYMENT_KEY -d "Content-Length: 0"
19 changes: 19 additions & 0 deletions .github/workflows/deploy-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: production_deployment

on: workflow_call

jobs:
deploy_production:
runs-on: ubuntu-latest

env:
DEPLOYMENT_KEY: ${{ secrets.DEPLOYMENT_KEY_PRODUCTION }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME_PRODUCTION }}
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"
helenb marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 19 additions & 0 deletions .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
@@ -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 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"
44 changes: 44 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.8.2
- 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 --skip-glob '**/migrations/*'
- name: black
run: black --check --diff ./rca fabfile.py --exclude migrations/
59 changes: 59 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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:
- uses: actions/checkout@v4
- 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 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
Loading
Loading