QIT Environment Dangling Test #262
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: QIT Environment Dangling Test | |
on: | |
# Every day at 11pm UTC (6pm ET) | |
schedule: | |
- cron: '0 23 * * *' | |
# Manually | |
workflow_dispatch: | |
jobs: | |
test_stop_random_container: | |
runs-on: ubuntu-latest | |
env: | |
NO_COLOR: 1 | |
QIT_DISABLE_ONBOARDING: yes | |
steps: | |
- name: Checkout code (Cross-platform) | |
uses: actions/checkout@v4 | |
- name: Setup PHP (Cross-platform) | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- name: Run setup script | |
run: bash .github/workflows/tests/environments/setup.sh ${{ secrets.QIT_STAGING_SECRET }} https://stagingcompatibilitydashboard.wpcomstaging.com | |
- name: Environment Setup and Checks | |
id: env_setup | |
run: bash .github/workflows/tests/environments/start-and-assert.sh | |
- name: Store the environment path in a ENV var | |
working-directory: src | |
run: echo "TEMPORARY_ENV=$(php qit-cli.php env:list --field=temporary_env)" >> $GITHUB_ENV | |
- name: Stop a random container from that environment. | |
working-directory: src | |
run: | | |
CONTAINERS=$(php qit-cli.php env:list --field=docker_images) | |
RANDOM_CONTAINER=$(echo $CONTAINERS | awk '{print $1}') | |
echo "Stopping container: $RANDOM_CONTAINER" | |
docker stop $RANDOM_CONTAINER | |
- name: Run a env:list to trigger the Dangling Environment Cleanup | |
working-directory: src | |
run: php qit-cli.php env:list | |
- name: Environment Cleanup Checks | |
id: env_cleanup | |
run: bash .github/workflows/tests/environments/dangling-cleanup-assert.sh | |
test_delete_environment_entry: | |
runs-on: ubuntu-latest | |
env: | |
NO_COLOR: 1 | |
QIT_DISABLE_ONBOARDING: yes | |
steps: | |
- name: Checkout code (Cross-platform) | |
uses: actions/checkout@v4 | |
- name: Setup PHP (Cross-platform) | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- name: Run setup script | |
run: bash .github/workflows/tests/environments/setup.sh ${{ secrets.QIT_STAGING_SECRET }} https://stagingcompatibilitydashboard.wpcomstaging.com | |
- name: Environment Setup and Checks | |
id: env_setup | |
run: bash .github/workflows/tests/environments/start-and-assert.sh | |
- name: Find and delete all hidden JSON files in the directory | |
working-directory: src | |
run: php qit-cli.php cache delete environment_monitor | |
- name: Run a env:list to trigger the Dangling Environment Cleanup | |
working-directory: src | |
run: php qit-cli.php env:list | |
- name: Environment Cleanup Checks | |
id: env_cleanup | |
run: bash .github/workflows/tests/environments/dangling-cleanup-assert.sh |