-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (67 loc) · 2.68 KB
/
qit-environment-dangling-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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