Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Testground
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Felix Tjahyadi
Testground
Commits
5d46895a
Commit
5d46895a
authored
1 year ago
by
Dylan Dahran Pribadi
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yml file
parent
4f46e72e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+82
-0
82 additions, 0 deletions
.gitlab-ci.yml
with
82 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
82
−
0
View file @
5d46895a
# This example is for testing Django with MySQL.
#
# The test CI/CD variables MYSQL_DB, MYSQL_USER and MYSQL_PASS can be set in the project settings at:
# Settings --> CI/CD --> Variables
#
# The Django settings in settings.py, used in tests, might look similar to:
#
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': os.environ.get('MYSQL_DATABASE'),
# 'USER': os.environ.get('MYSQL_USER'),
# 'PASSWORD': os.environ.get('MYSQL_PASSWORD'),
# 'HOST': 'mysql',
# 'PORT': '3306',
# 'CONN_MAX_AGE':60,
# },
# }
#
# It is possible to use '--settings' to specify a custom settings file on the command line below or use an environment
# variable to trigger an include on the bottom of your settings.py:
# if os.environ.get('DJANGO_CONFIG')=='test':
# from .settings_test import *
#
# It is also possible to hardcode the database name and credentials in the settings.py file and in the .gitlab-ci.yml file.
#
# The mysql service needs some variables too. See https://hub.docker.com/_/mysql for possible mysql env variables
# Note that when using a service in GitLab CI/CD that needs environment variables to run, only variables defined in
# .gitlab-ci.yml are passed to the service and variables defined in the GitLab UI are not.
# https://gitlab.com/gitlab-org/gitlab/-/issues/30178
variables
:
# DJANGO_CONFIG: "test"
MYSQL_DATABASE
:
$MYSQL_DB
MYSQL_ROOT_PASSWORD
:
$MYSQL_PASS
MYSQL_USER
:
$MYSQL_USER
MYSQL_PASSWORD
:
$MYSQL_PASS
default
:
image
:
ubuntu:20.04
#
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: https://docs.gitlab.com/ee/ci/services/index.html
services
:
-
mysql:8.0
#
# This folder is cached between builds
# http://docs.gitlab.com/ee/ci/yaml/README.html#cache
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 makemigrations myapp
-
python3 manage.py migrate
-
python3 manage.py check
django-tests
:
stage
:
test
script
:
# The MYSQL user only gets permissions for MYSQL_DB, so Django can't create a test database.
-
echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql
# use python3 explicitly. see https://wiki.ubuntu.com/Python/3
-
python3 manage.py test
deploy
:
stage
:
deploy
script
:
echo "Define your deployment script!"
environment
:
production
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment