-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from infinitered/workflow
unify circle-ci configs
- Loading branch information
Showing
29 changed files
with
114 additions
and
410 deletions.
There are no files selected for viewing
This file contains 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,6 @@ | ||
--- | ||
"docusaurus": patch | ||
"@infinitered/infinite-red-ai": patch | ||
--- | ||
|
||
Fix test issues and broken links. |
This file contains 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,211 +1,47 @@ | ||
# Config for the setup workflow and common resources (jobs, commands) for main workflows | ||
# `common-` prefix is added for common resources (to avoid conflicts with module resources) | ||
|
||
version: 2.1 | ||
|
||
setup: << pipeline.parameters.run-setup >> | ||
|
||
# All pipeline parameters need to be defined equally both for the setup workflow and main workflows | ||
# These parameters will be passed to both of them | ||
parameters: | ||
run-setup: | ||
description: Whether it is a setup workflow or a continuation | ||
type: boolean | ||
default: true | ||
force-all: | ||
description: Emergency valve - forcibly build all the modules | ||
type: boolean | ||
default: false | ||
custom-parameter: | ||
description: Some string to pass | ||
type: string | ||
default: "" | ||
# Docker defaults | ||
defaults: &defaults | ||
docker: | ||
- image: cimg/node:18.16.1 | ||
working_directory: /mnt/ramdisk/repo | ||
|
||
# Custom commands aimed for the main workflows and jobs | ||
|
||
commands: | ||
common-install-deps: | ||
# Jobs | ||
jobs: | ||
test_and_build: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
# Restore Yarn cache (Yarn 3 uses .yarn/cache directory) | ||
- restore_cache: | ||
name: Restore Yarn Package Cache | ||
name: Restore Yarn Cache | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- yarn-cache-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Use local Yarn version | ||
command: echo "export PATH=$(pwd)/.yarn/releases:$PATH" >> $BASH_ENV | ||
- run: | ||
name: Install Dependencies | ||
command: yarn install --immutable | ||
# Save Yarn cache | ||
- save_cache: | ||
name: Save Yarn Package Cache | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
name: Save Yarn Cache | ||
key: yarn-cache-{{ checksum "yarn.lock" }} | ||
paths: | ||
- .yarn/cache | ||
- .yarn/unplugged | ||
common-static-tests: | ||
parameters: | ||
working_directory: | ||
description: Path to the directory where the tests are run | ||
type: string | ||
default: . | ||
steps: | ||
- run: | ||
working_directory: << parameters.working_directory >> | ||
name: Run static tests | ||
command: yarn lint && yarn test | ||
no_output_timeout: 5m | ||
common-build-core: | ||
steps: | ||
name: Lint code | ||
command: yarn lint | ||
- run: | ||
working_directory: /mnt/ramdisk/repo/modules/react-native-mlkit-core | ||
name: Build core library | ||
command: yarn build | ||
common-build: | ||
parameters: | ||
working_directory: | ||
description: Path to the directory where the tests are run | ||
type: string | ||
default: . | ||
steps: | ||
name: Run tests | ||
command: yarn test | ||
- run: | ||
working_directory: << parameters.working_directory >> | ||
name: Build package | ||
command: yarn build | ||
|
||
name: Build everything including docs | ||
command: yarn ci:build | ||
|
||
# Workflows | ||
workflows: | ||
# The setup workflow | ||
setup-workflow: | ||
when: << pipeline.parameters.run-setup >> | ||
jobs: | ||
- config-splitting/setup-dynamic-config: | ||
force-all: << pipeline.parameters.force-all >> | ||
base-revision: main | ||
# If A is modified, the job for A will run | ||
# Similarly if B is modified, the job for B will run | ||
# If C is modified, then the jobs for both C and B (as a dependency) will run | ||
modules: | | ||
modules/react-native-mlkit-core | ||
modules/react-native-mlkit-face-detection | ||
modules/react-native-mlkit-image-labeling | ||
modules/react-native-mlkit-object-detection | ||
orbs: | ||
# An "embedded" orb to facilitate config splitting | ||
config-splitting: | ||
# Dependencies | ||
orbs: | ||
continuation: circleci/[email protected] | ||
# Commands for the setup workflow | ||
commands: | ||
list-changed-modules: | ||
parameters: | ||
modules: | ||
description: | | ||
Directories which should be built upon changes. | ||
Each row represents a space-separated list of the root directories for modules, each of which must has own `.circleci/config.yml`. | ||
The first item of the list will be tested for changes, and will be added to the filtered list of modules if there are any changes. | ||
The subsequent items, if there are any, will also be added to the filtered list of modules if there are any changes in the directory specified as the first item. | ||
CAVEAT: Directory names having white spaces cannot be specified. | ||
type: string | ||
modules-filtered: | ||
description: Path to the file where the filtered list of modules is generated | ||
type: string | ||
default: /tmp/modules-filtered.txt | ||
base-revision: | ||
description: Revision to compare with the current HEAD | ||
type: string | ||
default: main | ||
force-all: | ||
description: Emergency valve - forcibly build all the modules | ||
type: boolean | ||
default: false | ||
steps: | ||
- run: | ||
name: Generate the list of modules having changes | ||
command: | | ||
# Add each module to `modules-filtered` if 1) `force-all` is set to `true`, 2) there is a diff against `base-revision`, 3) there is no `HEAD~1` (i.e., this is the very first commit for the repo) OR 4) there is a diff against the previous commit | ||
cat \<< EOD | sed -e '/^$/d' | while read row; do module="$(echo "$row" | awk '{ print $1 }')"; if [ << parameters.force-all >> == 'true' ] || [ $(git diff --name-only << parameters.base-revision >> "$module" | wc -l) -gt 0 ] || (! git rev-parse --verify HEAD~1) || [ $(git diff --name-only HEAD~1 "$module" | wc -l) -gt 0 ]; then echo "$row" | sed -e 's/ /\n/g' >> << parameters.modules-filtered >>; fi; done | ||
<< parameters.modules >> | ||
EOD | ||
merge-modular-configs: | ||
parameters: | ||
modules: | ||
description: Path to the file for the list of the modules to build | ||
type: string | ||
default: /tmp/modules-filtered.txt | ||
shared-config: | ||
description: Path to the config providing shared resources (such as prerequisite jobs and common commands) | ||
type: string | ||
default: .circleci/config.yml | ||
continue-config: | ||
description: Path to the internally-used config for continuation | ||
type: string | ||
default: .circleci/continue-config.yml | ||
steps: | ||
- run: | ||
name: Merge configs | ||
command: | | ||
# If `modules` is unavailable, stop this job without continuation | ||
if [ ! -f "<< parameters.modules >>" ] || [ ! -s "<< parameters.modules >>" ] | ||
then | ||
echo 'Nothing to merge. Halting the job.' | ||
circleci-agent step halt | ||
exit | ||
fi | ||
# Convert a list of dirs to a list of config.yml | ||
sed -i -e 's/$/\/.circleci\/config.yml/g' "<< parameters.modules >>" | ||
# If `shared-config` exists, append it at the end of `modules` | ||
if [ -f << parameters.shared-config >> ] | ||
then | ||
echo "<< parameters.shared-config >>" >> "<< parameters.modules >>" | ||
fi | ||
xargs -a "<< parameters.modules >>" yq -y -s 'reduce .[] as $item ({}; . * $item)' | tee "<< parameters.continue-config >>" | ||
version: 2 | ||
build-and-test: | ||
jobs: | ||
# The job for the setup workflow | ||
setup-dynamic-config: | ||
parameters: | ||
modules: | ||
description: Directories which should be tested for changes; one directory per line. Each directory must have `.circleci/config.yml`. | ||
type: string | ||
base-revision: | ||
description: Revision to compare with the current HEAD | ||
type: string | ||
default: main | ||
force-all: | ||
description: Emergency valve - forcibly build all the modules | ||
type: boolean | ||
default: false | ||
modules-filtered: | ||
description: Path to the file where the filtered list of modules is generated | ||
type: string | ||
default: /tmp/modules-filtered.txt | ||
shared-config: | ||
description: Path to the config providing shared resources (such as prerequisite jobs and common commands) | ||
type: string | ||
default: .circleci/config.yml | ||
continue-config: | ||
description: Path to the internally-used config for continuation | ||
type: string | ||
default: .circleci/continue-config.yml | ||
docker: | ||
- image: cimg/python:3.9 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install yq | ||
command: pip install yq | ||
- list-changed-modules: | ||
modules: << parameters.modules >> | ||
modules-filtered: << parameters.modules-filtered >> | ||
base-revision: << parameters.base-revision >> | ||
force-all: << parameters.force-all >> | ||
- merge-modular-configs: | ||
modules: << parameters.modules-filtered >> | ||
shared-config: << parameters.shared-config >> | ||
continue-config: << parameters.continue-config >> | ||
- continuation/continue: | ||
configuration_path: << parameters.continue-config >> | ||
parameters: '{"run-setup":false}' | ||
- test_and_build |
This file contains 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
This file contains 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
Binary file removed
BIN
-31.2 KB
.yarn/cache/@next-eslint-plugin-next-npm-13.4.19-817cacb033-d60c136e4a.zip
Binary file not shown.
Binary file removed
BIN
-4.65 KB
.yarn/cache/@types-react-test-renderer-npm-18.0.1-ebbbc57718-ec149c2ab4.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-34.4 KB
.yarn/cache/electron-to-chromium-npm-1.4.523-5bcdc6898d-c090a958af.zip
Binary file not shown.
Binary file removed
BIN
-2.85 KB
.yarn/cache/eslint-config-next-npm-13.4.19-3238aea6fb-2b2e527fac.zip
Binary file not shown.
Binary file removed
BIN
-25.2 KB
.yarn/cache/expo-module-scripts-npm-3.1.0-c122b855d6-1a85033524.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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,6 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "react" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
modules/react-native-mlkit-face-detection/.circleci/config.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.