Skip to content

Commit

Permalink
build: capturing new migrations.
Browse files Browse the repository at this point in the history
  • Loading branch information
awais786 committed Oct 30, 2023
1 parent e528ee7 commit 278d58f
Showing 1 changed file with 138 additions and 138 deletions.
276 changes: 138 additions & 138 deletions .github/workflows/migrations-check.yml
Original file line number Diff line number Diff line change
@@ -1,138 +1,138 @@
name: Check Django Migrations

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
check_migrations:
name: check migrations
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
python-version: [ 3.8 ]
# 'pinned' is used to install the latest patch version of Django
# within the global constraint i.e. Django==3.2.21 in current case
# because we have global constraint of Django<4.2
django-version: ["pinned", "4.2"]
mongo-version: ["4"]
mysql-version: ["5.7", "8"]
# excluding mysql5.7 with Django 4.2 since Django 4.2 has
# dropped support for MySQL<8
exclude:
- django-version: "4.2"
mysql-version: "5.7"
services:
mongo:
image: mongo:${{ matrix.mongo-version }}
ports:
- 27017:27017
# Note: Calling mongo here only works with mongo 4, in newer versions of mongo
# we'll have to use `mongosh`
options: >-
--health-cmd "mongo --quiet --eval 'db.runCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 3
mysql:
image: mysql:${{ matrix.mysql-version }}
ports:
- 3306:3306
env:
MYSQL_DATABASE: "edxapp"
MYSQL_USER: "edxapp001"
MYSQL_PASSWORD: "password"
MYSQL_RANDOM_ROOT_PASSWORD: true
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
steps:
- name: Setup mongodb user
run: |
mongosh edxapp --eval '
db.createUser(
{
user: "edxapp",
pwd: "password",
roles: [
{ role: "readWrite", db: "edxapp" },
]
}
);
'
- name: Verify mongo and mysql db credentials
run: |
mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select 1;" edxapp
mongosh --host 127.0.0.1 --username edxapp --password password --eval 'use edxapp; db.adminCommand("ping");' edxapp
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install system Packages
run: |
sudo apt-get update
make ubuntu-requirements
- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/development.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install Python dependencies
run: |
make dev-requirements
if [[ "${{ matrix.django-version }}" != "pinned" ]]; then
pip install "django~=${{ matrix.django-version }}.0"
pip check # fail if this test-reqs/Django combination is broken
fi
- name: list installed package versions
run: |
sudo pip freeze
- name: Run Tests
env:
LMS_CFG: lms/envs/minimal.yml
# This is from the LMS dir on purpose since we don't need anything different for the CMS yet.
STUDIO_CFG: lms/envs/minimal.yml
run: |
echo "Running the LMS migrations."
./manage.py lms migrate
echo "Running the CMS migrations."
./manage.py cms migrate
# This job aggregates test results. It's the required check for branch protection.
# https://github.com/marketplace/actions/alls-green#why
# https://github.com/orgs/community/discussions/33579
success:
name: Migrations checks successful
if: always()
needs:
- check_migrations
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
# uses: re-actors/[email protected]
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
jobs: ${{ toJSON(needs) }}
#name: Check Django Migrations
#
#on:
# workflow_dispatch:
# pull_request:
# push:
# branches:
# - master
#
#jobs:
# check_migrations:
# name: check migrations
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ ubuntu-20.04 ]
# python-version: [ 3.8 ]
# # 'pinned' is used to install the latest patch version of Django
# # within the global constraint i.e. Django==3.2.21 in current case
# # because we have global constraint of Django<4.2
# django-version: ["pinned", "4.2"]
# mongo-version: ["4"]
# mysql-version: ["5.7", "8"]
# # excluding mysql5.7 with Django 4.2 since Django 4.2 has
# # dropped support for MySQL<8
# exclude:
# - django-version: "4.2"
# mysql-version: "5.7"
# services:
# mongo:
# image: mongo:${{ matrix.mongo-version }}
# ports:
# - 27017:27017
# # Note: Calling mongo here only works with mongo 4, in newer versions of mongo
# # we'll have to use `mongosh`
# options: >-
# --health-cmd "mongo --quiet --eval 'db.runCommand(\"ping\")'"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 3
# mysql:
# image: mysql:${{ matrix.mysql-version }}
# ports:
# - 3306:3306
# env:
# MYSQL_DATABASE: "edxapp"
# MYSQL_USER: "edxapp001"
# MYSQL_PASSWORD: "password"
# MYSQL_RANDOM_ROOT_PASSWORD: true
# options: >-
# --health-cmd "mysqladmin ping"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 3
# steps:
# - name: Setup mongodb user
# run: |
# mongosh edxapp --eval '
# db.createUser(
# {
# user: "edxapp",
# pwd: "password",
# roles: [
# { role: "readWrite", db: "edxapp" },
# ]
# }
# );
# '
#
# - name: Verify mongo and mysql db credentials
# run: |
# mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select 1;" edxapp
# mongosh --host 127.0.0.1 --username edxapp --password password --eval 'use edxapp; db.adminCommand("ping");' edxapp
#
# - name: Checkout repo
# uses: actions/checkout@v2
#
# - name: Setup Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
#
# - name: Install system Packages
# run: |
# sudo apt-get update
# make ubuntu-requirements
#
# - name: Get pip cache dir
# id: pip-cache-dir
# run: |
# echo "::set-output name=dir::$(pip cache dir)"
#
# - name: Cache pip dependencies
# id: cache-dependencies
# uses: actions/cache@v3
# with:
# path: ${{ steps.pip-cache-dir.outputs.dir }}
# key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/development.txt') }}
# restore-keys: ${{ runner.os }}-pip-
#
# - name: Install Python dependencies
# run: |
# make dev-requirements
# if [[ "${{ matrix.django-version }}" != "pinned" ]]; then
# pip install "django~=${{ matrix.django-version }}.0"
# pip check # fail if this test-reqs/Django combination is broken
# fi
#
# - name: list installed package versions
# run: |
# sudo pip freeze
#
# - name: Run Tests
# env:
# LMS_CFG: lms/envs/minimal.yml
# # This is from the LMS dir on purpose since we don't need anything different for the CMS yet.
# STUDIO_CFG: lms/envs/minimal.yml
# run: |
# echo "Running the LMS migrations."
# ./manage.py lms migrate
# echo "Running the CMS migrations."
# ./manage.py cms migrate
#
# # This job aggregates test results. It's the required check for branch protection.
# # https://github.com/marketplace/actions/alls-green#why
# # https://github.com/orgs/community/discussions/33579
# success:
# name: Migrations checks successful
# if: always()
# needs:
# - check_migrations
# runs-on: ubuntu-latest
# steps:
# - name: Decide whether the needed jobs succeeded or failed
# # uses: re-actors/[email protected]
# uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
# with:
# jobs: ${{ toJSON(needs) }}

0 comments on commit 278d58f

Please sign in to comment.