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 31, 2023
1 parent 067fdf7 commit aaf85b5
Showing 1 changed file with 33 additions and 40 deletions.
73 changes: 33 additions & 40 deletions .github/workflows/capture_new_migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,67 +137,60 @@ jobs:
# echo "Subtraction Result: $subtraction_result"

- name: Verify executed migrations on master.
id: capture1
id: capture12
shell: bash
run: |
query_result1=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select 1;" edxapp;)
numeric_result=$(echo "$query_result" | tr -d '[:space:]')
query_result=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select count(*) from django_migrations;" edxapp;)
numeric_result=$(echo "$query_result" | sed 's/[^0-9]*//g')
echo "Numeric Result: $numeric_result"
echo "FIRST_QUERY=$numeric_result" >> $GITHUB_ENV
- name: Step 12
run: |
subtraction_result=${{ env.FIRST_QUERY }}
echo "State is: subtraction_result"
- name: Checkout branch repo
uses: actions/checkout@v2

# - 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: 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: |
# pip freeze
- name: list installed package versions
run: |
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
- 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
- name: Verify executed migrations on branch.
shell: bash
id: capture2
run: |
captured_result="${{ env.query_r }}"
echo "Captured Output: $captured_result"
query_result=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select count(*) from django_migrations;" edxapp;)
numeric_result=$(echo "$query_result" | tr -d '[:space:]')
query_result=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select count(*) from django_migrations;" edxapp;)
numeric_result=$(echo "$query_result" | sed 's/[^0-9]*//g')
echo "Numeric Result: $numeric_result"
echo "FIRST_QUERY=$numeric_result" >> $GITHUB_ENV
echo "SECOND_QUERY=$numeric_result" >> $GITHUB_ENV
- name: Verify difference
run: |
echo "echo ${{env.FIRST_QUERY}}"
# echo "echo ${{env.query_result1}}"
# number1=${{ env.query_result1 }}
# number2=${{ env.query_result1 }}
echo "echo ${{env.SECOND_QUERY}}"
number1=${{ env.FIRST_QUERY }}
number2=${{ env.SECOND_QUERY }}
# # Perform subtraction
# diff=$((number1 - number2))
# result=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select 1 ;" edxapp;)
# echo "Query Result: $result"
# echo "$result"
diff=$((SECOND_QUERY - FIRST_QUERY))
result=$(mysql -h 127.0.0.1 -uedxapp001 -ppassword -e "select * from django_migrations ORDER by -id limit 3 ; ;" edxapp;)
echo "Query Result: $result"
echo "$result"
shell: bash


Expand Down

0 comments on commit aaf85b5

Please sign in to comment.