Skip to content

Commit

Permalink
2023 Day 1 and reorganization (#1)
Browse files Browse the repository at this point in the history
* clean for 2023

* 2023 day 1 complete
  • Loading branch information
Colin Sullivan authored Dec 2, 2023
1 parent 7a07edd commit 39ecf13
Show file tree
Hide file tree
Showing 91 changed files with 6,905 additions and 2,629 deletions.
12 changes: 10 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"features": {
"ghcr.io/devcontainers-contrib/features/poetry:1": {}
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install"
"postCreateCommand": "poetry install",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"charliermarsh.ruff"
]
}
},
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
Expand Down
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

## Describe the bug
A clear and concise description of what the bug is.

## To Reproduce

### Environment
Output of `aoc debug-version-info`:
```
...
```

### Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## Expected behavior
A clear and concise description of what you expected to happen.

## Screenshots
If applicable, add screenshots to help explain your problem.

## Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

### Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context or screenshots about the feature request here.
29 changes: 29 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
categories:
- title: ":boom: Breaking Changes"
label: "breaking"
- title: ":rocket: Features"
label: "enhancement"
- title: ":fire: Removals and Deprecations"
label: "removal"
- title: ":beetle: Fixes"
label: "bug"
- title: ":racehorse: Performance"
label: "performance"
- title: ":rotating_light: Testing"
label: "testing"
- title: ":construction_worker: Continuous Integration"
label: "ci"
- title: ":books: Documentation"
label: "documentation"
- title: ":hammer: Refactoring"
label: "refactoring"
- title: ":lipstick: Style"
label: "style"
- title: ":package: Dependencies"
labels:
- "dependencies"
- "build"
template: |
## Changes
$CHANGES
108 changes: 108 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# This workflow will install Python dependencies, run tests and lint.
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
checks:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:

- name: Install poetry
run: |
pipx install poetry
- name: Chekout Repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"

- name: Install dependencies
run: |
poetry env use 3.11
poetry config installer.modern-installation false
poetry install
- name: Verify formatting
run: |
poetry run ruff . --select I
poetry run ruff format --check .
- name: Lint
run: |
poetry run ruff . --exit-zero
poetry run mypy --install-types --non-interactive .
poetry run mypy --html-report=mypy_report .
- name: "Upload Mypy Report"
uses: actions/upload-artifact@v3
with:
name: mypy
path: mypy_report

- name: Build Docs
run: |
make docs
- name: Upload Docs
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/site

- name: Build Wheel
run: |
python -m pip install --upgrade pip
pip install build
python -m build .
- name: "Upload Distribution"
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

- name: Run tests
run: |
poetry run coverage run -m pytest --html=test_report.html --self-contained-html
- name: "Upload Coverage"
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.*

- name: Show Coverage Report
run: |
poetry run coverage combine
poetry run coverage report
- name: Create HTML report
run: |
poetry run coverage html
- name: Upload HTML report
uses: actions/upload-artifact@v3
with:
name: coverage_html
path: htmlcov

- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage

- name: Check minimum coverage
run: |
poetry run coverage report
poetry run echo '## Test Coverage Report' >> $GITHUB_STEP_SUMMARY
poetry run coverage report --format markdown >> $GITHUB_STEP_SUMMARY
113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Release

on:
workflow_run:
workflows: ["CI"]
branches: [main]
types:
- completed
workflow_dispatch:

permissions:
contents: write
jobs:
draft-release:
permissions:
contents: write
pull-requests: write
name: Draft Release
runs-on: ubuntu-latest
outputs:
build_assets: ${{ steps.check-version.outputs.tag }}
upload_url: ${{ steps.update-release.outputs.upload_url }}
steps:
- name: Install poetry
run: |
pipx install poetry
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"

- name: Install dependencies
run: |
poetry env use 3.11
poetry config installer.modern-installation false
poetry install
- name: Detect and tag new version
id: check-version
uses: salsify/[email protected]
with:
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
- name: Publish the release notes
id: update-release
uses: release-drafter/[email protected]
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-release-assets:
name: Build Release Assets
runs-on: ubuntu-latest
needs: draft-release
if: ${{ needs.draft-release.outputs.build_assets != '' }}
steps:
- name: Install poetry
run: |
pipx install poetry
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"

- name: Install dependencies
run: |
poetry env use 3.11
poetry config installer.modern-installation false
poetry install
- name: Build Distribution
run: |
python -m pip install --upgrade pip
pip install build
python -m build .
- name: Upload Distribution Assets
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.draft-release.outputs.upload_url }}
asset_path: dist/*

- name: Build Documentation
run: |
make docs
zip -r docs.zip docs/site
- name: Upload Documentation Assets
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.draft-release.outputs.upload_url }}
asset_path: docs.zip

- name: Publish docs to github pages
run: |
cd docs/; poetry run mkdocs gh-deploy --force
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
.pytest_cache
.vscode
htmlcov
.DS_Store
.DS_Store
.venv
.ruff_cache
.coverage
*.html
mypy_report
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: docs/docs/CLI.md
- id: end-of-file-fixer
exclude: docs/docs/CLI.md
- id: check-yaml
- id: check-added-large-files
- id: check-ast
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: detect-private-key

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.1.5"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
Loading

0 comments on commit 39ecf13

Please sign in to comment.