2020-06-18 14:49:13 +07:00
|
|
|
#!/usr/bin/env bash
|
2020-03-09 08:32:07 +07:00
|
|
|
set -u
|
|
|
|
|
2020-03-21 20:42:29 +07:00
|
|
|
DIVERGED=$(git merge-base --fork-point origin/master > /dev/null; echo $?)
|
|
|
|
|
2021-06-26 08:45:21 +07:00
|
|
|
if [[ "${DIVERGED}" == 0 ]]; then
|
|
|
|
if [[ "${BUILDKITE_TAG}" == "" ]]; then
|
|
|
|
if [[ "${BUILDKITE_BRANCH}" == "master" ]]; then
|
2021-08-02 10:32:04 +07:00
|
|
|
CI_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^(CODE_OF_CONDUCT.md|CONTRIBUTING.md|README.md|SECURITY.md|\.all-contributorsrc|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
|
2020-03-21 20:42:29 +07:00
|
|
|
else
|
2021-08-02 10:32:04 +07:00
|
|
|
CI_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^(CODE_OF_CONDUCT.md|CONTRIBUTING.md|README.md|SECURITY.md|\.all-contributorsrc|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
|
2020-03-21 20:42:29 +07:00
|
|
|
fi
|
|
|
|
|
2020-04-01 05:44:57 +07:00
|
|
|
if [[ $CI_BYPASS == "true" ]]; then
|
|
|
|
cat .buildkite/annotations/bypass | buildkite-agent annotate --style "info" --context "ctx-info"
|
2020-03-21 20:42:29 +07:00
|
|
|
fi
|
2020-03-15 17:07:23 +07:00
|
|
|
else
|
2020-04-01 05:44:57 +07:00
|
|
|
CI_BYPASS="false"
|
2020-03-15 17:07:23 +07:00
|
|
|
fi
|
2020-03-15 18:01:52 +07:00
|
|
|
else
|
2020-04-01 05:44:57 +07:00
|
|
|
CI_BYPASS="false"
|
2020-03-11 06:25:47 +07:00
|
|
|
fi
|
|
|
|
|
2020-03-09 08:32:07 +07:00
|
|
|
cat << EOF
|
|
|
|
env:
|
2020-04-01 05:44:57 +07:00
|
|
|
CI_BYPASS: ${CI_BYPASS}
|
2020-03-09 08:32:07 +07:00
|
|
|
|
|
|
|
steps:
|
2020-04-22 20:10:22 +07:00
|
|
|
- label: ":service_dog: Linting"
|
2020-12-03 14:06:42 +07:00
|
|
|
command: "reviewdog -reporter=github-check -filter-mode=nofilter -fail-on-error"
|
2020-04-29 09:30:46 +07:00
|
|
|
retry:
|
|
|
|
automatic: true
|
2021-08-07 07:06:42 +07:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.message !~ /\[(skip test|test skip)\]/
|
2020-04-22 20:10:22 +07:00
|
|
|
|
2020-03-09 08:32:07 +07:00
|
|
|
- label: ":hammer_and_wrench: Unit Test"
|
2021-06-25 18:53:20 +07:00
|
|
|
command: "authelia-scripts --log-level debug ci --buildkite"
|
2021-02-22 10:24:01 +07:00
|
|
|
agents:
|
|
|
|
build: "unit-test"
|
2020-04-28 21:07:20 +07:00
|
|
|
artifact_paths:
|
|
|
|
- "authelia-public_html.tar.gz"
|
|
|
|
- "authelia-public_html.tar.gz.sha256"
|
2021-01-03 11:28:46 +07:00
|
|
|
key: "unit-test"
|
2020-05-02 08:41:53 +07:00
|
|
|
if: build.env("CI_BYPASS") != "true"
|
2020-03-09 08:32:07 +07:00
|
|
|
|
|
|
|
- wait:
|
2020-04-01 05:44:57 +07:00
|
|
|
if: build.env("CI_BYPASS") != "true"
|
2020-03-09 08:32:07 +07:00
|
|
|
|
|
|
|
- label: ":docker: Image Builds"
|
|
|
|
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
|
2021-02-22 07:13:51 +07:00
|
|
|
concurrency: 3
|
|
|
|
concurrency_group: "builds"
|
2020-03-09 08:32:07 +07:00
|
|
|
depends_on: ~
|
2020-04-01 05:44:57 +07:00
|
|
|
if: build.env("CI_BYPASS") != "true"
|
2020-03-09 08:32:07 +07:00
|
|
|
|
2021-06-26 08:45:21 +07:00
|
|
|
- label: ":debian: Package Builds"
|
|
|
|
command: ".buildkite/steps/debpackages.sh | buildkite-agent pipeline upload"
|
|
|
|
depends_on: ~
|
2021-06-27 10:58:58 +07:00
|
|
|
if: build.branch !~ /^(dependabot|renovate)\/.*/ && build.env("CI_BYPASS") != "true"
|
2021-06-26 08:45:21 +07:00
|
|
|
|
|
|
|
- wait:
|
|
|
|
if: build.env("CI_BYPASS") != "true"
|
|
|
|
|
|
|
|
- label: ":vertical_traffic_light: Build Concurrency Gate"
|
|
|
|
command: "echo End of concurrency gate"
|
|
|
|
concurrency: 3
|
|
|
|
concurrency_group: "builds"
|
|
|
|
if: build.env("CI_BYPASS") != "true"
|
|
|
|
|
2020-03-09 08:32:07 +07:00
|
|
|
- wait:
|
2021-08-07 07:06:42 +07:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2020-03-09 08:32:07 +07:00
|
|
|
|
|
|
|
- label: ":chrome: Integration Tests"
|
|
|
|
command: ".buildkite/steps/e2etests.sh | buildkite-agent pipeline upload"
|
2021-02-22 07:13:51 +07:00
|
|
|
concurrency: 3
|
|
|
|
concurrency_group: "tests"
|
2020-03-09 08:32:07 +07:00
|
|
|
depends_on:
|
2020-06-05 07:43:19 +07:00
|
|
|
- "build-docker-linux-coverage"
|
2021-08-07 07:06:42 +07:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2021-06-26 08:45:21 +07:00
|
|
|
|
|
|
|
- wait:
|
2021-08-07 07:06:42 +07:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2021-06-26 08:45:21 +07:00
|
|
|
|
|
|
|
- label: ":vertical_traffic_light: Test Concurrency Gate"
|
|
|
|
command: "echo End of concurrency gate"
|
|
|
|
concurrency: 3
|
|
|
|
concurrency_group: "tests"
|
2021-08-07 07:06:42 +07:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2020-04-03 12:13:24 +07:00
|
|
|
EOF
|