mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-02 13:29:10 +00:00
Compare commits
2 commits
63ec5e5d80
...
ba0e2bb880
Author | SHA1 | Date | |
---|---|---|---|
|
ba0e2bb880 | ||
|
fcb898e319 |
2 changed files with 23 additions and 10 deletions
|
@ -36,6 +36,12 @@ jobs:
|
|||
- run: make checks-frontend
|
||||
- run: make test-frontend-coverage
|
||||
- run: make frontend
|
||||
- name: Install zstd for cache saving
|
||||
# works around https://github.com/actions/cache/issues/1169, because the
|
||||
# consuming job has zstd and doesn't restore the cache otherwise
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get -q install -qq -y zstd
|
||||
- name: "Cache frontend build for playwright testing"
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
var (
|
||||
changesetFiles []string
|
||||
changesetAvailable bool
|
||||
alwaysPatterns []glob.Glob
|
||||
globalFullRun bool
|
||||
)
|
||||
|
||||
func initChangedFiles() {
|
||||
|
@ -26,7 +26,7 @@ func initChangedFiles() {
|
|||
changesetFiles = strings.Split(changes, `\n`)
|
||||
log.Info("Only running tests covered by a subset of test files. Received the following list of CHANGED_FILES: %q", changesetFiles)
|
||||
|
||||
alwaysTest := []string{
|
||||
globalPatterns := []string{
|
||||
// meta and config
|
||||
"Makefile",
|
||||
"playwright.config.js",
|
||||
|
@ -39,18 +39,25 @@ func initChangedFiles() {
|
|||
// templates
|
||||
"templates/base/**",
|
||||
}
|
||||
for _, expr := range alwaysTest {
|
||||
globPattern, err := glob.Compile(expr, '.', '/')
|
||||
if err != nil {
|
||||
log.Fatal("Invalid glob pattern '%s' (skipped): %v", expr, err)
|
||||
fullRunPatterns := []glob.Glob{}
|
||||
for _, expr := range globalPatterns {
|
||||
fullRunPatterns = append(fullRunPatterns, glob.MustCompile(expr, '.', '/'))
|
||||
}
|
||||
globalFullRun = false
|
||||
for _, changedFile := range changesetFiles {
|
||||
for _, pattern := range fullRunPatterns {
|
||||
if pattern.Match(changedFile) {
|
||||
globalFullRun = true
|
||||
log.Info("Changed files match global test pattern, running all tests")
|
||||
return
|
||||
}
|
||||
}
|
||||
alwaysPatterns = append(alwaysPatterns, globPattern)
|
||||
}
|
||||
}
|
||||
|
||||
func canSkipTest(testFile string) bool {
|
||||
// run all tests when environment variable is not set
|
||||
if !changesetAvailable {
|
||||
// run all tests when environment variable is not set or changes match global pattern
|
||||
if !changesetAvailable || globalFullRun {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -76,7 +83,7 @@ func getWatchPatterns(filename string) []glob.Glob {
|
|||
scanner := bufio.NewScanner(file)
|
||||
|
||||
watchSection := false
|
||||
patterns := alwaysPatterns
|
||||
patterns := []glob.Glob{}
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
// check for watch block
|
||||
|
|
Loading…
Reference in a new issue