Skip to content

Commit 2890a9a

Browse files
committed
DEV: Split plugin core features system tests into a seperate workflow
The `plugin system tests` job is taking too long to run after core features system tests were added to all official plugins. Therefore, we are splitting out the plugin core features system tests into another workflow so that more tests are ran concurrently. There is also no need to split out chat system tests from plugin system tests anymore since the plugin core features system tests is now the bottleneck..
1 parent abee294 commit 2890a9a

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
TESTEM_BROWSER: ${{ (startsWith(matrix.browser, 'Firefox') && 'Firefox') || matrix.browser }}
4747
TESTEM_FIREFOX_PATH: ${{ (matrix.browser == 'Firefox Evergreen') && '/opt/firefox-evergreen/firefox' }}
4848
EMBER_ENV: development
49+
INSTALL_OFFICIAL_PLUGINS: ${{ ((matrix.target == 'plugins' || matrix.target == 'plugins core features') && '1') || '0' }}
4950

5051
strategy:
5152
fail-fast: false
@@ -59,7 +60,7 @@ jobs:
5960
target: themes
6061
include:
6162
- build_type: system
62-
target: chat
63+
target: "plugins core features"
6364
- build_type: frontend
6465
target: core
6566
browser: Firefox Evergreen
@@ -121,11 +122,11 @@ jobs:
121122
run: pnpm install --frozen-lockfile
122123

123124
- name: Checkout official plugins
124-
if: matrix.target == 'plugins'
125+
if: env.INSTALL_OFFICIAL_PLUGINS == '1'
125126
run: bin/rake plugin:install_all_official
126127

127128
- name: Symlinking plugin gems from image
128-
if: matrix.target == 'plugins'
129+
if: env.INSTALL_OFFICIAL_PLUGINS == '1'
129130
run: |
130131
for dir in /var/www/discourse/plugins/*/gems; do
131132
plugin_name=$(basename "$(dirname "$dir")")
@@ -143,7 +144,7 @@ jobs:
143144
done
144145
145146
- name: Pull compatible versions of plugins
146-
if: matrix.target == 'plugins' && (github.ref_name != 'main' && github.base_ref != 'main')
147+
if: env.INSTALL_OFFICIAL_PLUGINS == '1' && (github.ref_name != 'main' && github.base_ref != 'main')
147148
run: bin/rake plugin:pull_compatible_all
148149

149150
- name: Checkout official themes
@@ -289,14 +290,16 @@ jobs:
289290
env:
290291
CHECKOUT_TIMEOUT: 10
291292
run: |
292-
LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-pattern="plugins/chat/*" --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system
293+
LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-patterns="**/core_features_spec.rb" --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system
293294
shell: bash
294295

295-
- name: Chat System Tests
296-
if: matrix.build_type == 'system' && matrix.target == 'chat'
296+
- name: Plugin Core Features System Tests
297+
if: matrix.build_type == 'system' && matrix.target == 'plugins core features'
297298
env:
298299
CHECKOUT_TIMEOUT: 10
299-
run: LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/chat/spec/system
300+
run: |
301+
LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --include-patterns="**/core_features_spec.rb" --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system
302+
shell: bash
300303

301304
- name: Theme System Tests
302305
if: matrix.build_type == 'system' && matrix.target == 'themes'

bin/turbo_rspec

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ profile_print_slowest_examples_count = 10
1616
use_runtime_info = nil
1717
enable_system_tests = nil
1818
retry_and_log_flaky_tests = ENV["DISCOURSE_TURBO_RSPEC_RETRY_AND_LOG_FLAKY_TESTS"].to_s == "1"
19-
exclude_pattern = nil
19+
exclude_patterns = nil
20+
include_patterns = nil
2021

2122
OptionParser
2223
.new do |opts|
@@ -68,9 +69,14 @@ OptionParser
6869
end
6970

7071
opts.on(
71-
"--exclude-pattern=pattern",
72-
"Exclude files that matches against the pattern using unix-style pattern matching",
73-
) { |pattern| exclude_pattern = pattern }
72+
"--exclude-patterns=<pattern1>,<pattern2>",
73+
"Exclude files that matches against the patterns using unix-style pattern matching.",
74+
) { |pattern| exclude_patterns = pattern }
75+
76+
opts.on(
77+
"--include-patterns=<pattern1>,<pattern2>",
78+
"Only include files that matches against the patterns using unix-style pattern matching",
79+
) { |pattern| include_patterns = pattern }
7480
end
7581
.parse!(ARGV)
7682

@@ -101,7 +107,17 @@ else
101107
use_runtime_info = false if use_runtime_info.nil?
102108
end
103109

104-
files.reject! { |file| File.fnmatch(exclude_pattern, file) } if exclude_pattern
110+
if exclude_patterns
111+
exclude_patterns
112+
.split(",")
113+
.each { |pattern| files.reject! { |file| File.fnmatch(pattern, file) } }
114+
end
115+
116+
if include_patterns
117+
include_patterns
118+
.split(",")
119+
.each { |pattern| files.reject! { |file| !File.fnmatch(pattern, file) } }
120+
end
105121

106122
requires.each { |f| require(f) }
107123

0 commit comments

Comments
 (0)