Skip to content

Updated hashes for user-role-permissions.txt in unit tests. #361

Updated hashes for user-role-permissions.txt in unit tests.

Updated hashes for user-role-permissions.txt in unit tests. #361

name: Run integration test
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set TERM environment variable
run: echo "TERM=xterm-256color" >> $GITHUB_ENV
- name: Set git email
run: git config --global user.email "mjordan@sfu.ca"
- name: Set git name
run: git config --global user.name "Mark Jordan"
- name: Checkout workbench
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Checkout isle-site-template
uses: actions/checkout@v6
with:
repository: Islandora-Devops/isle-site-template
path: isle-site-template
- name: Install mkcert
run: |-
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
- name: Start islandora-starter-site
shell: 'bash'
working-directory: isle-site-template
env:
ISLANDORA_TAG: main
ISLANDORA_STARTER_REF: "heads/main"
ISLANDORA_STARTER_OWNER: "Islandora-Devops"
GITHUB_ACTIONS: "true"
TERM: "xterm-256color"
run: |
make overwrite-starter-site init up \
ISLANDORA_TAG="main" \
ISLANDORA_STARTER_REF="heads/main" \
ISLANDORA_STARTER_OWNER="Islandora-Devops" \
GITHUB_ACTIONS="true" \
TERM="xterm-256color"
- name: Test switching frontend to TLS
working-directory: isle-site-template
run: ./scripts/traefik-https-mkcert.sh
- name: Restart Traefik to apply TLS changes
working-directory: isle-site-template
run: docker compose down traefik && docker compose up -d traefik
- name: make sure traefik is serving traffic
shell: 'bash'
working-directory: isle-site-template
run: ./scripts/ping.sh
env:
TERM: xterm-256color
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
# disable media standalone URL
docker exec isle-site-template-drupal-1 drush config:set media.settings standalone_url FALSE -y
docker exec isle-site-template-drupal-1 drush cr
- name: Install migrations
run: docker exec isle-site-template-drupal-1 drush migrate:import --userid=1 --tag=islandora -y
- name: Update file media type to allow jpg extension
run: |
EXTS=$(docker exec isle-site-template-drupal-1 drush config:get field.field.media.file.field_media_file settings.file_extensions | sed -E "s/.*: '(.*)'/\1/")
if echo "$EXTS" | grep -qw "jpg"; then
echo "jpg already present"
else
NEW_EXTS="$EXTS jpg"
echo "Updating extensions to: $NEW_EXTS"
docker exec isle-site-template-drupal-1 drush config:set field.field.media.file.field_media_file settings.file_extensions "$NEW_EXTS" -y
fi
- name: Reinstall islandora_workbench_integration views
run: |
docker exec isle-site-template-drupal-1 drush config:import --partial --source=/var/www/drupal/web/modules/contrib/islandora_workbench_integration/config/optional -y
docker exec isle-site-template-drupal-1 drush cr
- name: Explicitly state the admin password
run: docker exec isle-site-template-drupal-1 drush user:password admin 'admin'
- name: Create workbench_user role
run: |
docker exec isle-site-template-drupal-1 drush role:create workbench_user
docker exec isle-site-template-drupal-1 drush role:perm:add workbench_user "$(cat tests/assets/user-role-permissions.txt | sed '/^$/d' | tr '\n' ',')"
- name: Create test user with workbench_user role
run: |
docker exec isle-site-template-drupal-1 drush user:create test-user --mail='test@noreply.com' --password='testPassword'
docker exec isle-site-template-drupal-1 drush user:role:add workbench_user test-user
- name: Run islandora_tests_check
run: pytest -v --no-header tests/islandora_tests_check.py
env:
REQUESTS_CA_BUNDLE: ${{ github.workspace }}/isle-site-template/certs/rootCA.pem
- name: Run islandora_tests_paged_content
run: pytest -v --no-header tests/islandora_tests_paged_content.py
env:
REQUESTS_CA_BUNDLE: ${{ github.workspace }}/isle-site-template/certs/rootCA.pem
- name: Run islandora_tests
run: pytest -v --no-header tests/islandora_tests.py
- name: Run islandora_tests_recovery_mode
run: pytest -v --no-header tests/islandora_tests_recovery_mode.py
env:
REQUESTS_CA_BUNDLE: ${{ github.workspace }}/isle-site-template/certs/rootCA.pem
- name: Run csv_id_to_node_id_map_tests
run: python tests/csv_id_to_node_id_map_tests.py
# DEBUG ARTIFACTS - Add these steps at the end
- name: Collect debug artifacts on failure
if: failure()
run: |
mkdir -p debug-artifacts
# Docker container logs
echo "=== Docker container logs ===" > debug-artifacts/docker-info.log
docker ps -a >> debug-artifacts/docker-info.log
echo -e "\n=== Drupal container logs ===" >> debug-artifacts/docker-info.log
docker logs isle-site-template-drupal-1 >> debug-artifacts/drupal.log 2>&1 || echo "Could not get Drupal logs"
# Drupal status and configuration
docker exec isle-site-template-drupal-1 drush status > debug-artifacts/drupal-status.txt 2>&1 || echo "Could not get Drupal status"
docker exec isle-site-template-drupal-1 drush config:get system.site > debug-artifacts/site-config.txt 2>&1 || echo "Could not get site config"
# Workbench logs
cat workbench.log > debug-artifacts/workbench.log 2>&1 || echo "Could not get workbench logs"
# Environment variables and Python info
env | grep -E "(PYTHON|PATH|PWD)" > debug-artifacts/environment.txt
python --version >> debug-artifacts/environment.txt
pip list >> debug-artifacts/pip-packages.txt 2>&1 || echo "Could not list pip packages"
- name: Upload debug artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: debug-artifacts-${{ github.run_id }}
path: debug-artifacts/
retention-days: 7