Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Go Open Source
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-smith committed Sep 21, 2023
1 parent 4e6f17a commit ca1099d
Show file tree
Hide file tree
Showing 2,355 changed files with 391,183 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
*.DS_Store
*~$*
**/*.mo
.git*
.pytest*
.idea*
69 changes: 69 additions & 0 deletions .github/workflows/unit-test-mira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Unit tests on MIRA

on:
push:
pull_request:
branches: [develop, main]

env:
GITHUB_WORKFLOW: github_actions

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:14.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
max-parallel: 4
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Create environment variables file
run: |
touch .env
echo DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} >> .env
echo DJANGO_SETTINGS_MODULE=mira.settings >> .env
echo POSTGRES_NAME=postgres >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env
echo DB_HOST=localhost >> .env
echo EMAIL_HOST=localhost >> .env
echo EMAIL_PORT=1025 >> .env
echo EMAIL_HOST_USER='' >> .env
echo EMAIL_HOST_PASSWORD='' >> .env
#echo EMAIL_USE_TLS=False >> .env
echo MIRA_URL=http://127.0.0.1:8000 >> .env
echo DEFAULT_FROM_EMAIL='mira@alsigo.net' >> .env
echo MIRA_SUPERUSER_EMAIL='' >> .env
echo RECAPTCHA_PUBLIC_KEY=MyRecaptchaKey123 >> .env
echo RECAPTCHA_PRIVATE_KEY=MyRecaptchaPrivateKey456 >> .env
- name: Run migrations
run: |
export $(grep -v '^#' .env | xargs)
python manage.py makemigrations
python manage.py migrate
- name: Run tests
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres"
run: |
export $(grep -v '^#' .env | xargs)
find . -path '*/tests/*' -and -name 'test*.py' -and -not -path "./venv/*" | xargs pytest
22 changes: 22 additions & 0 deletions .github/workflows/version-change-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Version change checker
on:
pull_request:
branches: [main]
types: [opened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Check if VERSION file was modified
run: |
version_file="mira/VERSION"
if git diff --name-only HEAD^1 HEAD | grep -q "$version_file"; then
echo "$version_file has been modified in this pull request."
else
echo "::error::$version_file must be modified in this pull request."
exit 1
fi
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__pycache__
*.DS_Store
*~$*
staticfiles/*
*.mo
.env
dump.json
node_modules/
.vscode
mira/build.json
*.sqlite3
db/django_secret_key
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# syntax=docker/dockerfile:1
# Based on https://docs.docker.com/samples/django/

FROM python:3.11
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE=1

WORKDIR /code
COPY requirements.txt /code/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN apt update && \
apt install -y gettext && \
apt install -y locales

COPY mira /code/mira
COPY cal /code/cal
COPY core /code/core
COPY db/readme.txt /code/db/readme.txt
COPY iam /code/iam
COPY library /code/library
COPY locale /code/locale
COPY serdes /code/serdes
COPY static /code/static
COPY theme /code/theme
COPY manage.py startup.sh /code/

RUN django-admin makemessages --all -i venv && \
django-admin compilemessages -i venv

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen

ENTRYPOINT ["bash", "startup.sh"]
EXPOSE 8000
Loading

0 comments on commit ca1099d

Please sign in to comment.