Skip to content

Commit

Permalink
Merge pull request #1028 from lucyparsons/develop
Browse files Browse the repository at this point in the history
OpenOversight `v0.7.0`
  • Loading branch information
b-meson authored Aug 18, 2023
2 parents d7d3ef9 + 5c3b015 commit 12a5596
Show file tree
Hide file tree
Showing 309 changed files with 19,298 additions and 12,568 deletions.
116 changes: 0 additions & 116 deletions .circleci/config.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- New Contributor? Welcome!
We recommend you check your privacy settings, so the name and email associated with
the commits are what you want them to be. See the contribution guide at
https://github.com/lucyparsons/OpenOversight/blob/develop/CONTRIB.md#recommended-privacy-settings for more infos.
Also make sure you have read and abide by the code of conduct:
https://github.com/lucyparsons/OpenOversight/blob/develop/CODE_OF_CONDUCT.md
-->
## What issue are you seeing?
29 changes: 10 additions & 19 deletions PULL_REQUEST_TEMPLATE.md → .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
<!-- New Contributor? Welcome!
We recommend you check your privacy settings, so the name and email associated with
the commit are what you want them to be. See the contribution guide at
the commits are what you want them to be. See the contribution guide at
https://github.com/lucyparsons/OpenOversight/blob/develop/CONTRIB.md#recommended-privacy-settings for more infos.
Also make sure you have read and abide by the code of conduct:
https://github.com/lucyparsons/OpenOversight/blob/develop/CODE_OF_CONDUCT.md
https://github.com/lucyparsons/OpenOversight/blob/develop/CODE_OF_CONDUCT.md
If this pull request is not ready for review yet, please submit it as a draft.
-->

## Status

Ready for review / in progress
## Fixes issue
<!-- LINK YOUR ISSUE HERE -->

## Description of Changes

Fixes # .

Changes proposed in this pull request:

-
-
-

## Notes for Deployment

## Screenshots (if appropriate)

## Tests and linting

- [ ] I have rebased my changes on current `develop`
## Screenshots (if appropriate)

- [ ] pytests pass in the development environment on my local machine

- [ ] `flake8` checks pass
## Tests and linting
- [ ] This branch is up-to-date with the `develop` branch.
- [ ] `pytest` passes on my local development environment.
- [ ] `pre-commit` passes on my local development environment.
74 changes: 74 additions & 0 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish Docker image and deploy it

on:
push:
branches:
- develop
- main

env:
image_name: lucyparsons/openoversight
# env_mapping: {"develop": "staging", "main": "prod"}
env_name: ${{ fromJson(vars.env_mapping)[github.ref_name] }}
# docker_mapping: {"develop": "latest", "main": "stable"}
docker_name: ${{ fromJson(vars.docker_mapping)[github.ref_name] }}
python_version: "3.11"

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
file: dockerfiles/web/Dockerfile-prod
push: true
build-args: PYTHON_VERSION=${{ env.python_version }}
# Build the slimmer production target
target: production
tags: |
ghcr.io/${{ env.image_name }}:${{ github.sha }}
ghcr.io/${{ env.image_name }}:${{ env.docker_name }}
ghcr.io/${{ env.image_name }}:${{ env.docker_name }}-py${{ env.python_version }}
deploy:
name: Deploy code to respective server
needs: push_to_registry
runs-on: ubuntu-latest
permissions:
packages: read
defaults:
run:
shell: bash
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: install fabric
run: pip install fabric2
- name: setup ssh connection
run: install -m 600 -D /dev/null ~/.ssh/id_ed25519
# choose SSH key depending on which environment we want to deploy to
- name: ssh key staging
if: ${{ env.env_name == 'staging' }}
run: echo "${{secrets.SSH_STAGING_PRIVATE_KEY}}" > ~/.ssh/id_ed25519
- name: ssh key prod
if: ${{ env.env_name == 'prod' }}
run: echo "${{secrets.SSH_PROD_PRIVATE_KEY}}" > ~/.ssh/id_ed25519
# Next three steps use fabric2's "invoke" command which runs tasks defined in tasks.py
- name: backup db
run: invoke backup ${{ env.env_name }}
- name: deploy
run: invoke deploy ${{ env.env_name }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }}
- name: cleanup
run: invoke cleanup ${{ env.env_name }}
48 changes: 0 additions & 48 deletions .github/workflows/main.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Coverage
on:
push:
branches:
- develop

jobs:
test:
runs-on: ubuntu-latest
env:
FLASK_APP: OpenOversight.app
steps:
- uses: actions/checkout@v3
with:
python-version: "3.11"
- name: Run tests
run: |
PYTHON_VERSION=${{ matrix.python-version }} make test_with_version
- name: Upload Coverage Results
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: OpenOversight/tests/coverage.xml
36 changes: 36 additions & 0 deletions .github/workflows/test_prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

# Controls when the action will run.
on:
pull_request:
branches:
- develop
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
env:
FLASK_APP: OpenOversight.app
strategy:
matrix:
python-version: ["3.11"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Run tests
run: PYTHON_VERSION=${{ matrix.python-version }} make test_with_version
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: pre-commit/action@v3.0.0
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Credentials
dbcred*
service_account_key.json

# Local database backups
backup/*
Expand Down Expand Up @@ -40,6 +41,7 @@ var/
.installed.cfg
*.egg
.mypy_cache
.python-version

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -93,7 +95,9 @@ vagrant/puppet/.tmp
.vscode/**
*.code-workspace

# Operating system files
**/.DS_Store

node_modules/
OpenOverSight/app/static/dist/


static/
Loading

0 comments on commit 12a5596

Please sign in to comment.