Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration workflow #2

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Tutor Open edX CI

on: [push]

jobs:
setup-tutor:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install tutor

- name: Configure Tutor plugin
run: |
tutor config save
echo 'Patching Caddyfile...'
echo "
{$default_site_port} {
import proxy 'lms:8000'
}
" > $(tutor config printroot)/env/apps/caddy/Caddyfile

echo 'Patching CMS production settings...'
echo "ALLOWED_HOSTS = ['*']" > $(tutor config printroot)/env/apps/openedx/settings/cms/production.py

echo 'Patching LMS production settings...'
echo "ALLOWED_HOSTS = ['*']" > $(tutor config printroot)/env/apps/openedx/settings/lms/production.py

- name: Launch Tutor
run: |
tutor config save
tutor local launch -I

- name: Install eox-core and eox-tenant in LMS
run: |
# Install eox-core and eox-tenant in the LMS container
tutor local run lms pip install eox-core
tutor local run lms pip install eox-tenant
shell: bash

- name: Check Open edX LMS heartbeat
run: |
until curl -sSf http://local.edly.io/heartbeat; do
echo "Waiting for LMS to be ready..."
sleep 5
done
echo "LMS is up and running!"

- name: Check Open edX eox-core eox-info
run: |
until curl -sSf http://local.edly.io/eox-core/eox-info; do
echo "Waiting for EOX CORE to be ready..."
sleep 5
done
echo "EOX CORE is up and running!"

- name: Check eox-tenant eox-info
run: |
until curl -sSf http://local.edly.io/eox-tenant/eox-info; do
echo "Waiting for EOX TENANT to be ready..."
sleep 5
done
echo "EOX TENANT is up and running!"
81 changes: 45 additions & 36 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
name: Integration Test in Tutor
description: 'A Github action to test your plugin in Tutor (Open edX distribution)'
inputs:
app_name:
description: 'Application name to test. E.g., eox-tenant.'
required: true
tutor_version:
description: 'The tutor version matrix to use.'
required: true
shell_file_to_run:
description: 'The path of the shell file to run the integration tests.'
required: false

runs:
using: 'composite'
steps:
- name: Prepare Tutor and Launch
run: |
pip install "tutor$INPUT_TUTOR_VERSION"
TUTOR_ROOT="$(pwd)" tutor --version
TUTOR_ROOT="$(pwd)" tutor config save
TUTOR_ROOT="$(pwd)" tutor mounts add lms,cms,lms-worker,cms-worker:$(pwd)/$INPUT_APP:/openedx/$INPUT_APP
chmod 777 . -R
TUTOR_ROOT="$(pwd)" tutor local launch -I
shell: bash
env:
INPUT_APP: ${{ inputs.app_name }}
INPUT_TUTOR_VERSION: ${{ inputs.tutor_version }}

- name: Run integration tests in lms
if: ${{ inputs.shell_file_to_run }}
run: |
TUTOR_ROOT="$(pwd)" tutor local run lms bash $INPUT_SHELL_FILE
shell: bash
env:
INPUT_SHELL_FILE: /openedx/${{ inputs.app_name }}/${{ inputs.shell_file_to_run }}
name: Tutor Setup with Plugin Verification

on: [push, pull_request]

jobs:
setup-tutor:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11'

- name: Install Tutor
run: |
python3 -m pip install --upgrade pip
python3 -m pip install tutor

- name: Add extra LMS requirements
run: |
# Create a custom Tutor configuration to add extra pip requirements for the LMS
tutor config save --set LMS_EXTRA_PIP_REQUIREMENTS="eox-core\neox-tenant"

- name: Rebuild the LMS image to include the extra requirements
run: |
tutor images build openedx

- name: Start Tutor
run: |
tutor local launch -I

- name: Wait for services to be up
run: |
sleep 60 # Adjust the sleep time as necessary for services to be fully ready

- name: Check LMS logs
run: |
tutor local logs lms --tail=100 # Retrieve the last 100 lines of LMS logs

- name: Check LMS heartbeat endpoint
run: |
curl -f http://localhost:8000/heartbeat
Loading