Skip to content

Commit

Permalink
Merge pull request #1 from maykinmedia/default-project-setup
Browse files Browse the repository at this point in the history
Default project setup
  • Loading branch information
Floris272 authored Nov 28, 2024
2 parents d1aa597 + 3417b9d commit ac3974b
Show file tree
Hide file tree
Showing 126 changed files with 8,113 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[bumpversion]
commit = False
tag = False
current_version = 0.1.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<pre>[a-z]+)\.(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{pre}.{build}
{major}.{minor}.{patch}

[bumpversion:part:pre]
first_value = alpha
values =
alpha
beta
rc

[bumpversion:file:src/open_producten/__init__.py]

[bumpversion:file:README.rst]
search = :Version: {current_version}
replace = :Version: {new_version}

[bumpversion:file:README.EN.rst]
search = :Version: {current_version}
replace = :Version: {new_version}

# [bumpversion:file:publiccode.yaml]
# search = softwareVersion: {current_version}
# replace = softwareVersion: {new_version}

[bumpversion:file:package.json]
search = "version": "{current_version}",
replace = "version": "{new_version}",
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.vscode
env/
local.py
/doc/_build/

/htmlcov
.coverage

/static/
/media/
/private_media/

.github/
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{scss,sass}]
indent_size = 2

[*.{yml,yaml}]
indent_size = 2
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Probleem melden / Bug report
description: Meldt een probleem om ons te helpen verbeteren / Create a report to help us improve
title: "Title here"
labels: ["bug", "triage"]
assignees: []
body:
- type: input
id: product-version
attributes:
label: Product versie / Product version
description: Welke versie gebruikt u? / Which version do you use?
placeholder: "1.1.0"
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: Omschrijf het probleem / Describe the bug
description: Een duidelijke omschrijving van het probleem (de "bug") / A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Stappen om te reproduceren / Steps to reproduce
description: Stappen die leiden tot het probleem / Steps to reproduce the behavior
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: false
- type: textarea
id: expected-behaviour
attributes:
label: Verwacht gedrag / Expected behavior
description: Een duidelijke omschrijving van wat de verwachting is / A clear and concise description of what you expected to happen.
validations:
required: false
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Verzoek tot verbetering / Feature request
description: Stel een idee voor om het product beter te maken / Suggest an idea for this product
title: "Title here"
labels: ["enhancement", "triage"]
assignees: []
body:
- type: dropdown
id: theme
attributes:
label: Thema / Theme
options:
- "TODO"
- "Admin"
- "Other"
validations:
required: true
- type: textarea
id: description
attributes:
label: Omschrijving / Description
description: Omschrijf duidelijk het idee of de behoefte, eventueel aangevuld met een bepaalde oplossingsrichting / Clearly describe the idea or need, possibly supplemented with a specific solution direction
validations:
required: true
- type: textarea
id: added-value
attributes:
label: Toegevoegde waarde / Added value
description: Omschrijf de toegevoegde waarde voor de bedrijfsvoering of dienstverlening / Describe the added value for business operations or services
validations:
required: false
- type: textarea
id: remarks
attributes:
label: Aanvullende opmerkingen / Additional context
description: Voeg aanvullingen of mockups toe voor deze verbetering / Add any other context or screenshots about the feature request
validations:
required: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/prepare-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Prepare release
about: Checklist for new releases
title: Prepare release x.y.z
labels: ''
---

- [ ] Resolve release blockers
- [ ] ...
- [ ] Check translations
- [ ] Backend
- [ ] Frontend
- [ ] Bump API version number
- [ ] Version bump
- [ ] Regenerate API spec
- [ ] Update READMEs with release dates + links
- [ ] Bump version number (including package-lock.json)
- [ ] Update changelog
5 changes: 5 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ondersteuning met prioriteit / Priority support
url: https://opengem.nl/contact/
about: Neem direct contact met ons op / Contact us directly to get priority support.
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Fixes #

**Changes**

[Describe the changes here]

170 changes: 170 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Run build pipeline

# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- main
- stable/*
tags:
- '*'
pull_request:
workflow_dispatch:

env:
IMAGE_NAME: maykinmedia/open-producten
DJANGO_SETTINGS_MODULE: open_producten.conf.ci
DOCKER_BUILDKIT: '1'

jobs:

setup:
name: Set up the build variables
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.vars.outputs.tag }}
git_hash: ${{ steps.vars.outputs.git_hash }}

steps:
- name: Extract version information
id: vars
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name (if present at all)
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
# PRs result in version 'merge' -> transform that into 'latest'
[ "$VERSION" == "merge" ] && VERSION=latest
echo "tag=${VERSION}" >> $GITHUB_OUTPUT
echo "git_hash=${GITHUB_SHA}" >> $GITHUB_OUTPUT
tests:
name: Run the Django test suite
runs-on: ubuntu-latest

services:
postgres:
image: postgis/postgis:15-3.4
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
# Needed because the postgres container does not provide a healthcheck
options: >-
--name postgres
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up backend environment
uses: maykinmedia/[email protected]
with:
python-version: '3.11'
optimize-postgres: 'yes'
pg-service: 'postgres'
setup-node: 'no'
apt-packages: 'gdal-bin gettext'

- name: Run tests
run: |
python src/manage.py compilemessages
python src/manage.py collectstatic --noinput --link
coverage run src/manage.py test src
env:
SECRET_KEY: dummy
DB_USER: postgres
DB_PASSWORD: ''

- name: Publish coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

# docs:
# name: Build and check documentation
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# - uses: maykinmedia/[email protected]
# with:
# python-version: '3.11'
# setup-node: 'no'
# # apt-packages: 'gettext postgresql-client' # the default

# - name: Build and test docs
# run: |
# export OPENSSL_CONF=$(pwd)/openssl.conf
# pytest check_sphinx.py -v --tb=auto
# working-directory: docs

docker_build:
name: Build Docker image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.image_build.outputs.image_tag }}

needs:
- setup

steps:
- uses: actions/checkout@v4

- name: Build the production Docker image
id: image_build
run: |
image_tag="$IMAGE_NAME:$RELEASE_VERSION"
echo "image_tag=${image_tag}" >> $GITHUB_OUTPUT
docker build . \
--tag $image_tag \
--build-arg COMMIT_HASH=${{ needs.setup.outputs.git_hash }} \
--build-arg RELEASE=${{ needs.setup.outputs.tag }} \
env:
RELEASE_VERSION: ${{ needs.setup.outputs.tag }}

- run: docker image save -o image.tar $IMAGE_NAME:${{ needs.setup.outputs.tag }}
- name: Store image artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: image.tar
retention-days: 1

docker_push:
needs:
- tests
- docker_build

name: Push Docker image
runs-on: ubuntu-latest
if: github.event_name == 'push' # Exclude PRs

steps:
- name: Download built image
uses: actions/download-artifact@v4
with:
name: docker-image

- name: Load image
run: |
docker image load -i image.tar
- name: Log into registry
run:
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }}
--password-stdin

- name: Push the Docker image (production)
run: docker push ${{ needs.docker_build.outputs.image_tag }}
Loading

0 comments on commit ac3974b

Please sign in to comment.