Skip to content

Commit

Permalink
chore: CircleCI Monorepo setup (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenjohnson committed Oct 26, 2024
1 parent f6532ec commit 254ae5a
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2.1

# this allows you to use CircleCI's dynamic configuration feature
setup: true

# the path-filtering orb is required to continue a pipeline based on
# the path of an updated fileset
orbs:
path-filtering: circleci/[email protected]

workflows:
# the always-run workflow is always triggered, regardless of the pipeline parameters.
always-run:
jobs:
- path-filtering/filter:
name: check-updated-files

# Test which path is updated and set the parameter for continue_config
mapping: |
apps/backend/.* backend-changed true
apps/web/.* web-changed true
apps/mobile/.* mobile-changed true
# Compare changes of the branch with main branch
base-revision: main

# this is the path of the configuration we should trigger once
# path filtering and pipeline parameter value updates are
# complete. In this case, we are using the parent dynamic
# configuration itself.

config-path: .circleci/continue_config.yml
87 changes: 87 additions & 0 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
version: 2.1

commands:
setup:
steps:
- run:
command: |
corepack enable --install-directory ~/bin
yarn install
# the default pipeline parameters, which will be updated according to
# the results of the path-filtering orb
parameters:
backend-changed:
type: boolean
default: false
web-changed:
type: boolean
default: false
mobile-changed:
type: boolean
default: false

workflows:
run-backend-tests:
when: << pipeline.parameters.backend-changed >>
jobs:
- backend-tests
run-web-tests:
when: << pipeline.parameters.web-changed >>
jobs:
- web-tests
run-mobile-tests:
when: << pipeline.parameters.mobile-changed >>
jobs:
- mobile-tests

jobs:
backend-tests:
docker:
- image: cimg/node:20.17
- image: cimg/postgres:13.4-postgis
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: hylo
POSTGRES_DB: hylo_test
- image: redis
environment:
NODE_ENV: test
DATABASE_URL: postgres://localhost:5432/hylo_test
DOMAIN: testdomain
# this prevents jobs that were queued during testing from being run in development
KUE_NAMESPACE: qtest
PROTOCOL: http
# don't log errors to Rollbar
ROLLBAR_SERVER_TOKEN: 0
# you can set up a SendWithUs API key to return valid responses but send no email
SENDWITHUS_KEY: test_93e4ff1d5114d067bc207ba93ee9b758d047e583
steps:
- checkout
- setup
- run:
command: |
cd apps/backend
yarn test
web-tests:
docker:
- image: cimg/node:20.17
steps:
- checkout
- setup
- run:
command: |
cd apps/web
yarn test
mobile-tests:
docker:
- image: cimg/node:20.17
steps:
- checkout
- setup
- run:
command: |
cd apps/mobile
yarn test

0 comments on commit 254ae5a

Please sign in to comment.