Skip to content

Commit

Permalink
admin/upgrade-packaging-standards (#201)
Browse files Browse the repository at this point in the history
* Upgrade to new package standards

* Delete extra files

* Ignore files for check-manifest

* Remove lots of extra files, fix all type errors

* Fix dev infra justfile
  • Loading branch information
evamaxfield committed Aug 14, 2022
1 parent 48a9adb commit 2095b24
Show file tree
Hide file tree
Showing 50 changed files with 674 additions and 854 deletions.
10 changes: 10 additions & 0 deletions .cookiecutter.yaml
@@ -0,0 +1,10 @@
default_context:
author_name: "Eva Maxfield Brown, To Huynh, Isaac Na, Council Data Project Contributors"
author_email: "evamaxfieldbrown@gmail.com"
hosting_github_username_or_org: "CouncilDataProject"
project_name: "cdp-backend"
project_slug: "cdp-backend"
python_slug: "cdp_backend"
project_short_description: "Data storage utilities and processing pipelines used by CDP instances."
hosting_pypi_username: "CouncilDataProject"
license: "MIT License"
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Expand Up @@ -13,19 +13,19 @@ labels: bug

### Describe the Bug

_A clear and concise description of the bug._
<!-- A clear and concise description of the bug. -->

### Expected Behavior

_What did you expect to happen instead?_
<!-- What did you expect to happen instead? -->

### Reproduction

_Steps to reproduce the behavior and/or a minimal example that exhibits the behavior._
<!-- Steps to reproduce the behavior and/or a minimal example that exhibits the behavior. -->

### Environment

_Any additional information about your environment._
<!-- Any additional information about your environment. -->

- OS Version: _[e.g. macOS 11.3.1]_
- CDP Backend Version: _[e.g. 0.5.0]_
- cdp-backend Version: _[e.g. 0.5.0]_
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Expand Up @@ -13,16 +13,16 @@ labels: enhancement

### Feature Description

_A clear and concise description of the feature you're requesting._
<!-- A clear and concise description of the feature you're requesting. -->

### Use Case

_Please provide a use case to help us understand your request in context._
<!-- Please provide a use case to help us understand your request in context. -->

### Solution

_Please describe your ideal solution._
<!-- Please describe your ideal solution. -->

### Alternatives

_Please describe any alternatives you've considered, even if you've dismissed them._
<!-- Please describe any alternatives you've considered, even if you've dismissed them. -->
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -20,4 +20,4 @@ This pull request resolves #

### Description of Changes

_Include a description of the proposed changes._
<!-- Include a description of the proposed changes. -->
10 changes: 10 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,10 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
commit-message:
prefix: "ci(dependabot):"
38 changes: 0 additions & 38 deletions .github/workflows/build-docs.yml

This file was deleted.

86 changes: 0 additions & 86 deletions .github/workflows/check-pr.yml

This file was deleted.

77 changes: 48 additions & 29 deletions .github/workflows/build-main.yml → .github/workflows/ci.yml
@@ -1,34 +1,54 @@
name: Build
name: CI

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
schedule:
# <minute [0,59]> <hour [0,23]> <day of the month [1,31]>
# <month of the year [1,12]> <day of the week [0,6]>
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07
# Run every Monday at 10:24:00 PST
# (Since these CRONs are used by a lot of people -
# let's be nice to the servers and schedule it _not_ on the hour)
- cron: '24 18 * * 1'
- cron: "24 18 * * 1"
workflow_dispatch:

jobs:
# Check that all files listed in manifest make it into build
check-manifest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install check-manifest && check-manifest

# Check tests pass on multiple Python and OS combinations
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
python-version: [3.8, 3.9, "3.10"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Packages (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -48,54 +68,53 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Run tests with Tox
run: tox -e py
pip install .[infrastructure,pipeline,test]
- name: Run Tests
run: just test
- name: Upload Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

# Check linting, formating, types, etc.
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install graphviz
run: |
sudo apt update
sudo apt-get install graphviz --fix-missing
python-version: "3.10"
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
pip install .[lint]
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
run: just lint

# Publish to PyPI if test, lint, and manifest checks passed
publish:
if: "contains(github.event.head_commit.message, 'Bump version')"
needs: [test, lint]
if: "success() && startsWith(github.ref, 'refs/tags/')"
needs: [check-manifest, test, lint]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
python-version: "3.10"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install build wheel
- name: Build Package
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: CouncilDataProject
password: ${{ secrets.PYPI_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
@@ -0,0 +1,36 @@
name: Documentation

on:
push:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Packages
run: |
sudo apt update
sudo apt-get install graphviz --fix-missing
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
just install
- name: Generate Docs
run: |
just generate-docs
touch docs/_build/.nojekyll
- name: Publish Docs
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/

0 comments on commit 2095b24

Please sign in to comment.