v0.2.0
A ready-to-use CI/CD Pipeline for Django projects
Attributes
Includes Deno configuration
Repository
Current version released
3 years ago
Django Pipeline
A ready-to-use GitLab CI Pipeline and Jobs for your Django projects.
🚀 Usage
Quick start:
import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts";
const { pipeline } = GitLab;
pipeline.write(); // Write the pipeline to the file .gitlab-ci.ymlOr, if you want to use the predefined jobs:
import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci/mod.ts";
import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts";
const { install, migrations, djangoTests } = GitLab;
const const pipeline = new GitlabCI()
.variables({
MYSQL_DATABASE: "$MYSQL_DB",
MYSQL_ROOT_PASSWORD: "$MYSQL_PASS",
MYSQL_USER: "$MYSQL_USER",
MYSQL_PASSWORD: "$MYSQL_PASS",
})
.addJob("install", install)
.addJob("migrations", migrations)
.addJob("django-tests", djangoTests);
pipeline.write(); // Write the pipeline to the file .gitlab-ci.ymlIt will generate the following .gitlab-ci.yml file:
# Do not edit this file directly. It is generated by Fluent GitLab CI
variables:
MYSQL_DATABASE: $MYSQL_DB
MYSQL_ROOT_PASSWORD: $MYSQL_PASS
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASS
install:
image: ubuntu:20.04
services:
- mysql:8.0
cache:
paths:
- ~/.cache/pip/
before_script:
- apt -y update
- apt -y install apt-utils
- apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev
- apt -y upgrade
- pip3 install -r requirements.txt
migrations:
stage: build
script:
- python3 manage.py makemigrations
- python3 manage.py migrate
- python3 manage.py check
django-tests:
stage: test
script:
- echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql
- python3 manage.py test🧪 Advanced Usage
This package also provides a ready-to-use pipeline for Dagger, just run the following command on your Django project:
dagger run deno run -A https://deno.land/x/django_pipeline/ci.tsOr, if you want to use the predefined jobs:
import Client, { connect } from "@dagger.io/dagger";
import { Dagger } from "https://deno.land/x/django_pipeline/mod.ts";
const { djangoTests } = Dagger;
function pipeline(src = ".") {
connect(async (client: Client) => {
await djangoTests(client, src);
});
}
pipeline();