Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): consistency as external check #6460

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,39 @@ jobs:
username: ${{ github.event.pull_request.user.login || github.actor }}
runner_type: builder-x86
secrets: inherit
# job just to alert that you *might* hit missing CI files, but if not you can continue

ci-consistency:
runs-on: ubuntu-latest
# Only check PRs for consistency (not master)
if: ${{ github.event.pull_request.head.sha != '' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout Merge Pipeline Files
uses: actions/checkout@v4
with:
path: merge-commit-pipeline-files
sparse-checkout: |
.github/workflows/ci.yml
.github/workflows/setup-runner.yml

- name: Ensure CI Consistency
if: ${{ github.event.pull_request.head.sha != '' }}
run: |
# Compare the checked-out CI configuration files with the reference files
if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then
echo "Error: ci.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior."
exit 1
fi
if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then
echo "Error: setup-runner.yml changes in master (or PR base). *Usually* you can continue just fine. If you hit trouble with missing files, please merge these changes. This is to alert about potential surprises from Github Action's merge behavior."
exit 1
fi

build:
needs: setup
runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/setup-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,6 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout Merge Pipeline Files
uses: actions/checkout@v4
# Only check PRs for consistency (not master)
if: ${{ github.event.pull_request.head.sha != '' }}
with:
path: merge-commit-pipeline-files
sparse-checkout: |
.github/workflows/ci.yml
.github/workflows/setup-runner.yml

- name: Ensure CI Consistency
# Only check PRs for consistency (not master)
if: ${{ github.event.pull_request.head.sha != '' }}
run: |
# Compare the checked-out CI configuration files with the reference files
if ! git diff --no-index .github/workflows/ci.yml merge-commit-pipeline-files/.github/workflows/ci.yml; then
echo "Error: ci.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior."
exit 1
fi
if ! git diff --no-index .github/workflows/setup-runner.yml merge-commit-pipeline-files/.github/workflows/setup-runner.yml; then
echo "Error: setup-runner.yml changes in master (or PR base). Please merge these changes. This is to prevent surprises from Github Action's merge behavior."
exit 1
fi

- name: Start EC2 runner
uses: ./.github/ensure-builder
with:
Expand Down
Loading