Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HeliumEdu/template-project
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlaird committed Jun 21, 2024
2 parents e63491e + 9a7185a commit f7c986f
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 22 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Auto-Merge Dependabot PRs

on:
pull_request:

jobs:
automerge:
name: Auto-Merge Dependabot PRs

runs-on: ubuntu-latest

permissions:
pull-requests: write
contents: write

if: github.actor == 'dependabot[bot]'
steps:
- name: Get Dependabot metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 5 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,9 @@ jobs:
run: echo ::set-output name=BRANCH::${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
- name: Test
run: BRANCH=${{ steps.get_version.outputs.BRANCH }} make test

automerge:
name: "Auto Approve"
needs: build
runs-on: ubuntu-latest

permissions:
pull-requests: write
contents: write

steps:
- uses: fastify/github-action-merge-dependabot@v3
- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
target: major
use-github-auto-merge: true
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./build/template-project-test-build/build/coverage
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
![Python Versions](https://img.shields.io/badge/python-%203.8%20|%203.9%20|%203.10%20|%203.11%20-blue)
[![Build](https://img.shields.io/github/actions/workflow/status/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%}/build.yml)](https://github.com/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%}/actions/workflows/build.yml)
![GitHub License](https://img.shields.io/github/license/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%})
[![Coverage](https://img.shields.io/codecov/c/github/HeliumEdu/template-project)](https://codecov.io/gh/HeliumEdu/template-project)
[![Build](https://img.shields.io/github/actions/workflow/status/HeliumEdu/template-project/build.yml)](https://github.com/HeliumEdu/template-project/actions/workflows/build.yml)
![GitHub License](https://img.shields.io/github/license/HeliumEdu/template-project)

# {%PROJECT_NAME%}
# template-project

## Getting Started

The project is developed using Python and [Django](https://www.djangoproject.com).

This repository contains the source code for the {%PROJECT_NAME%} project.
This repository contains the source code for the HeliumEdu `template-project`, which can be initialized using
[`helium-cli`](https://github.com/HeliumEdu/heliumcli) with:

```
helium-cli init <project_id> <Project Name> <hostname> <githuber_username>
```

### Project Setup

Expand All @@ -18,13 +24,13 @@ To setup the Python/Django build environment, execute:
make install
```

This project is configured to work with a Virtualenv which has now been setup in the `.venv` folder. If you're
This project is configured to work with a Virtualenv which has now been setup in the `venv` folder. If you're
unfamiliar with how this works, [read up on Virtualenv here](https://virtualenv.pypa.io/en/stable). The short version
is, virtualenv creates isolated environments for each project's dependencies. To activate and use this environment when
developing, execute:

```sh
source .venv/bin/activate
source venv/bin/activate
```

All commands below will now be run within the virtualenv (though `make` commands will always automatically enter the
Expand Down
65 changes: 65 additions & 0 deletions README.md.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
![Python Versions](https://img.shields.io/badge/python-%203.8%20|%203.9%20|%203.10%20|%203.11%20-blue)
[![Coverage](https://img.shields.io/codecov/c/github/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%})](https://codecov.io/gh/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%})
[![Build](https://img.shields.io/github/actions/workflow/status/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%}/build.yml)](https://github.com/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%}/actions/workflows/build.yml)
![GitHub License](https://img.shields.io/github/license/{%PROJECT_GITHUB_USER%}/{%PROJECT_ID%})

# {%PROJECT_NAME%}

## Getting Started

The project is developed using Python and [Django](https://www.djangoproject.com).

This repository contains the source code for the {%PROJECT_NAME%} project.

### Project Setup

To setup the Python/Django build environment, execute:

```sh
make install
```

This project is configured to work with a Virtualenv which has now been setup in the `venv` folder. If you're
unfamiliar with how this works, [read up on Virtualenv here](https://virtualenv.pypa.io/en/stable). The short version
is, virtualenv creates isolated environments for each project's dependencies. To activate and use this environment when
developing, execute:

```sh
source venv/bin/activate
```

All commands below will now be run within the virtualenv (though `make` commands will always automatically enter the
virtualenv before executing).

To ensure the database is in sync with the latest schema, database migrations are generated and run with Django. To run
migrations, execute:

```sh
make migrate
```

Once migrations have been run, you can create a super user, which is a standard user that also has access to the /admin
site.

```sh
python manage.py createsuperuser
```

Before commits are made, be sure to run tests and check the generated coverage report.

```sh
make test
```

Now you're all set! To start the development server, execute:

```sh
bin/runserver
```

A development server will be started at <http://localhost:8000>, though there is no mounted root URL—visit
<http://localhost:8000/admin> or <http://localhost:8000/info> to see the project serve a request.

If the `USE_NGROK` environment variable is set when a dev server is started (using `runserver`),
[pyngrok](https://github.com/alexdlaird/pyngrok) will be used to open a `ngrok` tunnel. This is especially useful when
using webhooks.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
django==4.2.10
djangorestframework==3.15.1
django-pipeline==3.0.0
django-pipeline==3.1.0
django-dotenv==1.4.2
django-redis==5.4.0
coreapi==2.3.3
mysqlclient==2.2.4
pytz==2024.1
python-dateutil==2.9.0.post0
schedule==1.2.1
schedule==1.2.2
-e git+https://github.com/alexdlaird/[email protected]#egg=django-health-check

0 comments on commit f7c986f

Please sign in to comment.