-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore: use circleci cli to package ci configurations #32462
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
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
e66e778
add husky script to build circleci yml files
cacieprins bf75cda
add circleci cli as a required tool for working with .circleci
cacieprins b1aeba4
break the original workflows.yml file into separate pieces, using cir…
cacieprins d7dd504
fix pull request workflow def
cacieprins 2caafba
more robust precommit for circleci packing
cacieprins 7e4285f
even nicer stdout for precommit :)
cacieprins bdb8194
allow pr pipeline on this branch
cacieprins 79c4d96
split up the config.yml to demonstrate more fully
cacieprins 36895e0
Merge branch 'develop' into use-pack-for-circle
cacieprins c5c623c
Merge branch 'develop' into use-pack-for-circle
cacieprins 84d0529
fix conditional on pr pipeline
cacieprins fa96551
Merge branch 'develop' into use-pack-for-circle
cacieprins 2cd55e7
Merge branch 'develop' into use-pack-for-circle
cacieprins 826aa6b
exit 1 if circleci cli not found and circleci config files staged for…
cacieprins 51d6d0a
use linux-x64 executor for unit-tests
cacieprins 59c2f2b
try using ipv6 in contributor with correct executor
cacieprins 5d9a7b1
ensure node
cacieprins 5fb5125
update github action to update browser versions to point to the corre…
cacieprins 2d2d92d
ensure node more times
cacieprins 95ebbd1
fix export
cacieprins 4ac065b
reduce expected result count
cacieprins 897da0d
Merge branch 'develop' into use-pack-for-circle
cacieprins a9bcbe8
run full workflow menu on this branch
cacieprins 37ad3e6
bump config class to medium
cacieprins 666e6b0
index on use-pack-for-circle: a9bcbe87b0 run full workflow menu on th…
560635a
WIP on use-pack-for-circle: a9bcbe87b0 run full workflow menu on this…
cd5812b
Merge commit 'stash' into use-pack-for-circle
820ccc6
index on use-pack-for-circle: a9bcbe87b0 run full workflow menu on th…
883842e
WIP on use-pack-for-circle: a9bcbe87b0 run full workflow menu on this…
a091241
Merge commit 'stash' into use-pack-for-circle
74f176d
index on use-pack-for-circle: a9bcbe87b0 run full workflow menu on th…
9050e7c
WIP on use-pack-for-circle: a9bcbe87b0 run full workflow menu on this…
eab6571
Merge commit 'stash' into use-pack-for-circle
bef54ae
revert to small for checkout code in config workflow; remove from mul…
cacieprins 8670494
Merge branch 'develop' into use-pack-for-circle
cacieprins d5bf5cc
fix incorrect conflict resolution for bettersqlite3 changes w/ electr…
cacieprins 36714ff
make path to circleci workflows file more explicit, comment why it is…
cacieprins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# CircleCI Configuration | ||
|
||
This directory contains CircleCI configuration files that are automatically generated and updated. | ||
|
||
## Prerequisites | ||
|
||
### CircleCI Local CLI | ||
|
||
The CircleCI Local CLI is required to generate the `pull-request.yml` file from the source configuration. | ||
|
||
**Installation:** | ||
|
||
- **macOS (Homebrew):** | ||
```bash | ||
brew install circleci | ||
``` | ||
|
||
- **Linux:** | ||
```bash | ||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash | ||
``` | ||
|
||
- **Windows:** | ||
```bash | ||
choco install circleci-cli | ||
``` | ||
|
||
- **Manual installation:** | ||
Download from [CircleCI Local CLI releases](https://github.com/CircleCI-Public/circleci-cli/releases) | ||
|
||
For more detailed installation instructions, see the [CircleCI Local CLI documentation](https://circleci.com/docs/2.0/local-cli/). | ||
|
||
## Lint-Staged Rules | ||
|
||
When files in this directory are modified, the following lint-staged rule will automatically run: | ||
|
||
```bash | ||
circleci config pack .circleci/workflows-src > .circleci/workflows.yml | ||
``` | ||
|
||
This command: | ||
1. Takes the source configuration from `./.circleci/workflows-src/` | ||
2. Packs it into a single YAML file | ||
3. Outputs the result to `./circleci/workflows.yml` | ||
|
||
## File Structure | ||
|
||
- `workflows-src/` - Source configuration files (modify these) | ||
- `workflows.yml` - Generated configuration file (auto-generated, do not edit manually) | ||
|
||
## Development Workflow | ||
|
||
1. Make changes to files in `workflows-src/` | ||
2. The lint-staged hook will automatically regenerate `workflows.yml` and stage it | ||
3. Commit both the source changes and the generated file | ||
|
||
**Note:** Always commit both the source files and the generated `workflows.yml` file together to ensure the CircleCI configuration stays in sync. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,60 @@ | ||
version: 2.1 | ||
setup: true | ||
|
||
orbs: | ||
continuation: circleci/continuation@1.1.0 | ||
|
||
jobs: | ||
verify-ci-should-run: | ||
resource_class: small | ||
docker: | ||
- image: cimg/node:current | ||
steps: | ||
- run: | ||
name: Verify CI should run | ||
command: | | ||
# run CI when manually triggers via CircleCi Dashboard | ||
if [ <<pipeline.trigger_source>> == 'api' ]; then | ||
echo "Always run CI when manually triggered from the UI." | ||
exit 0 | ||
fi | ||
|
||
if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then | ||
echo "Always run CI for develop and for release candidate branches." | ||
exit 0 | ||
fi | ||
|
||
LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') | ||
|
||
if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then | ||
echo "Always run CI when the commit message includes 'run ci'." | ||
exit 0 | ||
fi | ||
|
||
cancel_build () { | ||
echo "Canceling the CI build..." | ||
circleci-agent step halt | ||
} | ||
|
||
TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." | ||
|
||
if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then | ||
DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') | ||
|
||
if [[ "${DRAFT}" == true ]]; then | ||
echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
fi | ||
|
||
echo "Always run CI for PR that is ready for review." | ||
exit 0 | ||
fi | ||
|
||
echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
- checkout | ||
- continuation/continue: | ||
configuration_path: .circleci/workflows.yml | ||
|
||
verify-ci-should-run: | ||
docker: | ||
- image: cimg/node:current | ||
resource_class: small | ||
steps: | ||
- run: | ||
command: | | ||
# run CI when manually triggers via CircleCi Dashboard | ||
if [ <<pipeline.trigger_source>> == 'api' ]; then | ||
echo "Always run CI when manually triggered from the UI." | ||
exit 0 | ||
fi | ||
|
||
if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then | ||
echo "Always run CI for develop and for release candidate branches." | ||
exit 0 | ||
fi | ||
|
||
LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') | ||
|
||
if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then | ||
echo "Always run CI when the commit message includes 'run ci'." | ||
exit 0 | ||
fi | ||
|
||
cancel_build () { | ||
echo "Canceling the CI build..." | ||
circleci-agent step halt | ||
} | ||
|
||
TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." | ||
|
||
if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then | ||
DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') | ||
|
||
if [[ "${DRAFT}" == true ]]; then | ||
echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
fi | ||
|
||
echo "Always run CI for PR that is ready for review." | ||
exit 0 | ||
fi | ||
|
||
echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
name: Verify CI should run | ||
- checkout | ||
- continuation/continue: | ||
configuration_path: .circleci/workflows.yml | ||
orbs: | ||
continuation: circleci/continuation@1.1.0 | ||
setup: true | ||
version: 2.1 | ||
workflows: | ||
# the setup-workflow workflow is always triggered. | ||
setup-workflow: | ||
jobs: | ||
- verify-ci-should-run | ||
setup-workflow: | ||
jobs: | ||
- verify-ci-should-run | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version: 2.1 | ||
setup: true | ||
orbs: | ||
continuation: circleci/continuation@1.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
resource_class: small | ||
docker: | ||
- image: cimg/node:current | ||
steps: | ||
- run: | ||
name: Verify CI should run | ||
command: | | ||
# run CI when manually triggers via CircleCi Dashboard | ||
if [ <<pipeline.trigger_source>> == 'api' ]; then | ||
echo "Always run CI when manually triggered from the UI." | ||
exit 0 | ||
fi | ||
|
||
if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then | ||
echo "Always run CI for develop and for release candidate branches." | ||
exit 0 | ||
fi | ||
|
||
LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') | ||
|
||
if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then | ||
echo "Always run CI when the commit message includes 'run ci'." | ||
exit 0 | ||
fi | ||
|
||
cancel_build () { | ||
echo "Canceling the CI build..." | ||
circleci-agent step halt | ||
} | ||
|
||
TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." | ||
|
||
if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then | ||
DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') | ||
|
||
if [[ "${DRAFT}" == true ]]; then | ||
echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
fi | ||
|
||
echo "Always run CI for PR that is ready for review." | ||
exit 0 | ||
fi | ||
|
||
echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" | ||
cancel_build | ||
- checkout | ||
- continuation/continue: | ||
configuration_path: .circleci/workflows.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jobs: | ||
- verify-ci-should-run |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strangely maxes out its resources checking out code. I wonder if this could be sped up with more. (I realize you didn't change this from before). https://app.circleci.com/pipelines/github/cypress-io/cypress/74784/workflows/2d0ba1d8-892a-4aee-9cac-b0d07ffd0700/jobs/3142881/resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, probably! We could switch this to medium. We could also do some custom git credential stuff and do a super shallow checkout - all we need is the target workflow file. The baked in
checkout
command does a pretty good job of doing the minimal, but it can't carve it down that far.I'd suggest we just bump it to medium, if we'd like to speed it up. There are much lower hanging fruit in the main pipeline for cost/performance.