Remove non-standard : anchors
This commit is contained in:
@ -3,24 +3,27 @@
|
|||||||
# Checks if a CI build affects one or more path patterns. Each command-line
|
# Checks if a CI build affects one or more path patterns. Each command-line
|
||||||
# argument is checked in series.
|
# argument is checked in series.
|
||||||
#
|
#
|
||||||
# Bash regular expresses are permitted in the pattern, and the colon (':')
|
# Bash regular expressions are permitted in the pattern:
|
||||||
# character is guaranteed to appear before and after each affected file (and thus
|
# ./affects-files.sh .rs$ -- any file or directory ending in .rs
|
||||||
# can be used as an anchor), eg:
|
# ./affects-files.sh .rs -- also matches foo.rs.bar
|
||||||
# .rs: -- any file or directory ending in .rs
|
# ./affects-files.sh ^snap/ -- anything under the snap/ subdirectory
|
||||||
# .rs -- also matches foo.rs.bar
|
# ./affects-files.sh snap/ -- also matches foo/snap/
|
||||||
# :snap/ -- anything under the snap/ subdirectory
|
|
||||||
# snap/ -- also matches foo/snap/
|
|
||||||
#
|
#
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")"/..
|
||||||
|
|
||||||
if ci/is-pr.sh; then
|
if ci/is-pr.sh; then
|
||||||
affectedFiles="$(buildkite-agent meta-data get affected_files)"
|
affectedFiles="$(buildkite-agent meta-data get affected_files)"
|
||||||
echo "Affected files in this PR: $affectedFiles"
|
echo "Affected files in this PR: $affectedFiles"
|
||||||
|
|
||||||
|
IFS=':' read -ra files <<< "$affectedFiles"
|
||||||
for pattern in "$@"; do
|
for pattern in "$@"; do
|
||||||
if [[ ":$affectedFiles:" =~ $pattern ]]; then
|
for file in "${files[@]}"; do
|
||||||
|
if [[ $file =~ $pattern ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
|
||||||
#
|
#
|
||||||
# Only run snap.sh for pull requests that modify files under /snap
|
# Only run snap.sh for pull requests that modify files under /snap
|
||||||
#
|
#
|
||||||
|
set -e
|
||||||
cd "$(dirname "$0")"/..
|
cd "$(dirname "$0")"/..
|
||||||
|
|
||||||
ci/affects-files.sh :snap/ || {
|
ci/affects-files.sh ^snap/ || {
|
||||||
echo "Skipping snap build as no files under /snap were modified"
|
echo "Skipping snap build as no files under /snap were modified"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
annotate() {
|
annotate() {
|
||||||
@ -10,10 +9,10 @@ annotate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ci/affects-files.sh \
|
ci/affects-files.sh \
|
||||||
.rs: \
|
.rs$ \
|
||||||
ci/test-bench.sh: \
|
ci/test-bench.sh \
|
||||||
|| {
|
|| {
|
||||||
annotate --style info --context coverage-info \
|
annotate --style info --context test-bench \
|
||||||
"Bench skipped as no .rs files were modified"
|
"Bench skipped as no .rs files were modified"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
annotate() {
|
annotate() {
|
||||||
@ -10,11 +9,11 @@ annotate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ci/affects-files.sh \
|
ci/affects-files.sh \
|
||||||
.rs: \
|
.rs$ \
|
||||||
ci/test-coverage.sh: \
|
ci/test-coverage.sh \
|
||||||
scripts/coverage.sh: \
|
scripts/coverage.sh \
|
||||||
|| {
|
|| {
|
||||||
annotate --style info --context coverage-info \
|
annotate --style info --context test-coverage \
|
||||||
"Coverage skipped as no .rs files were modified"
|
"Coverage skipped as no .rs files were modified"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user