-
Notifications
You must be signed in to change notification settings - Fork 7
139 lines (122 loc) · 4.46 KB
/
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Test
on:
- pull_request
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Commons
uses: ./.github/actions/commons
- name: Install dependencies
run: pnpm i
- name: Check formatting
run: pnpm test:format
- name: Build packages
run: pnpm build
- name: Run static tests
if: startsWith(github.head_ref, 'test-all/') == false
run: pnpm test:static
- name: Run all static tests
if: startsWith(github.head_ref, 'test-all/') == true
run: pnpm test:static:all
- name: Run unit tests
if: startsWith(github.head_ref, 'test-all/') == false
run: pnpm test:unit
- name: Run all unit tests
if: startsWith(github.head_ref, 'test-all/') == true
run: pnpm test:unit:all
- name: Run integration tests
if: startsWith(github.head_ref, 'test-all/') == false
run: pnpm test:integration
- name: Run all integration tests
if: startsWith(github.head_ref, 'test-all/') == true
run: pnpm test:integration:all
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: |
packages/**/playwright-report/**
packages/**/test-results/**
retention-days: 3
- name: Gatsby log
run: cat /tmp/gatsby.log || true
if: always()
- name: Drupal log
run: cat /tmp/drupal.log || true
if: always()
- name: Check for uncommitted changes
run: |
if [[ $(git status --porcelain) ]]
then
>&2 echo "Error: Found uncommitted changes. Lerna publish will fail."
git status --porcelain
git diff
false
else
echo "Success: Found no uncommitted changes"
fi
drupal_updates:
if: startsWith(github.head_ref, 'test-all/') == true
name: Check for forgotten config changes
runs-on: ubuntu-24.04
steps:
- name: Checkout BASE
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}
- name: Commons
uses: ./.github/actions/commons
- name: Install dependencies
run: pnpm i
- name: Build packages
run: pnpm build
- name: Checkout HEAD
run: git checkout ${{ github.event.pull_request.head.ref }}
- name: Check if there are config changes after Drupal updates
run: |
set -e
cd apps/silverback-drupal
set -x
# Delete vendor dir to avoid potential issues with `composer install`.
rm -rf vendor
composer install
output=$(pnpm drush -y updb --cache-clear=0 2>&1)
if echo $output | grep -q 'No pending updates'
then
echo "No drupal updates found."
exit 0
fi
pnpm drush -y cr
pnpm drush -y cex
cd -
# Check Git changes ignoring the config translations.
if [[ $(git status --porcelain -- apps/silverback-drupal/config ':!apps/silverback-drupal/config/sync/language') ]]
then
set +x
>&2 echo '⬇️ ⬇️ ⬇️ ⬇️ ⬇️️'
>&2 echo 'WARNING: Found uncommitted Drupal config changes after applying Drupal database updates.'
>&2 echo ''
>&2 echo 'If this check failed due to a Drupal database update which changed the Drupal config:'
>&2 echo ' - Checkout this branch locally'
>&2 echo ' - Switch to Drupal directory'
>&2 echo ' - Run `composer i && pnpm silverback setup --no-config-import && pnpm drush cex -y`'
>&2 echo ' - Review the config changes'
>&2 echo ' - Commit and push'
>&2 echo ''
>&2 echo 'Also, you can ignore this failure if you are really sure that everything is all right.'
>&2 echo '⬇️ ⬇️ ⬇️ ⬇️ ⬇️️️️'
set -x
git status --porcelain -- apps/silverback-drupal/config ':!apps/silverback-drupal/config/sync/language'
git diff -- apps/silverback-drupal/config ':!apps/silverback-drupal/config/sync/language'
false
else
echo 'Success: Found no new config changes.'
fi